]> git.basschouten.com Git - openhab-addons.git/blob
c56bc83f1c3d15759de14c677c9e508f5caebbac
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
7  * This program and the accompanying materials are made available under the
8  * terms of the Eclipse Public License 2.0 which is available at
9  * http://www.eclipse.org/legal/epl-2.0
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.atlona.internal.handler;
14
15 import org.openhab.core.thing.Thing;
16 import org.openhab.core.thing.binding.BaseThingHandler;
17
18 /**
19  * This abstract class should be the base class for any Atlona product line handler.
20  *
21  * @author Tim Roberts - Initial contribution
22  */
23 public abstract class AtlonaHandler<C extends AtlonaCapabilities> extends BaseThingHandler {
24
25     /**
26      * The model specific capabilities
27      */
28     private final C capabilities;
29
30     /**
31      * Constructs the handler from the specified thing and capabilities
32      *
33      * @param thing a non-null {@link org.openhab.core.thing.Thing}
34      * @param capabilities a non-null {@link org.openhab.binding.atlona.internal.handler.AtlonaCapabilities}
35      */
36     public AtlonaHandler(Thing thing, C capabilities) {
37         super(thing);
38
39         if (capabilities == null) {
40             throw new IllegalArgumentException("capabilities cannot be null");
41         }
42         this.capabilities = capabilities;
43     }
44
45     /**
46      * Returns the model specific capabilities
47      *
48      * @return a non-null {@link org.openhab.binding.atlona.internal.handler.AtlonaCapabilities}
49      */
50     protected C getCapabilities() {
51         return capabilities;
52     }
53 }