]> git.basschouten.com Git - openhab-addons.git/blob
dcbaa2cfdf161b7a6a195dce281bc771c7f10aea
[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.enocean.internal;
14
15 import org.eclipse.jdt.annotation.NonNull;
16 import org.openhab.core.thing.type.ChannelTypeUID;
17
18 /**
19  *
20  * @author Daniel Weber - Initial contribution
21  *         This class holds information for creating a channel of an EnOcean thing like acceptedItemType and
22  *         channelTypeUID
23  */
24 public class EnOceanChannelDescription {
25     public final ChannelTypeUID channelTypeUID;
26     public final String acceptedItemType;
27     @NonNull
28     public final String label;
29     public final boolean isStateChannel;
30     public final boolean autoCreate;
31
32     /**
33      * Ctor for an EnOceanChannelDescription
34      *
35      * @param channelTypeUID ChannelTypeUID of channel
36      * @param acceptedItemType AcceptedItemType of channel like Switch, Dimmer or null if we accept everything
37      */
38     public EnOceanChannelDescription(ChannelTypeUID channelTypeUID, String itemType) {
39         this(channelTypeUID, itemType, "", true, true);
40     }
41
42     /**
43      * Ctor for an EnOceanChannelDescription with detailed information
44      *
45      * @param channelTypeUID ChannelTypeUID of channel
46      * @param acceptedItemType ItemType of channel like Switch, Dimmer
47      * @param label of created channel
48      * @param isStateChannel otherwise created channel is a trigger channel
49      * @param autoCreate create channel during thing initialization, otherwise channel is created
50      *            manually/predefined
51      */
52     public EnOceanChannelDescription(ChannelTypeUID channelTypeUID, String itemType, String label,
53             boolean isStateChannel, boolean autoCreate) {
54         this.channelTypeUID = channelTypeUID;
55         this.acceptedItemType = itemType;
56         if (label != null) {
57             this.label = label;
58         } else {
59             this.label = "";
60         }
61
62         this.isStateChannel = isStateChannel;
63         this.autoCreate = autoCreate;
64     }
65 }