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