2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
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
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.io.neeo.internal.models;
15 import java.util.Objects;
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.openhab.core.thing.type.ChannelKind;
21 * Enumeration of channel kinds (item or trigger)
23 * @author Tim Roberts - Initial Contribution
26 public enum NeeoDeviceChannelKind {
27 /** Represents an item */
29 /** Represents a trigger item */
32 /** The text value of the enum */
33 private final String text;
36 * Constructs the NeeoDeviceChannelKind using the specified text
38 * @param text the text
40 private NeeoDeviceChannelKind(final String text) {
41 Objects.requireNonNull(text, "text is required");
46 * Parses the text into a NeeoDeviceChannelKind enum (ignoring case)
48 * @param text the text to parse
49 * @return the NeeoDeviceChannelKind type
51 public static NeeoDeviceChannelKind parse(final String text) {
55 for (NeeoDeviceChannelKind enm : NeeoDeviceChannelKind.values()) {
56 if (text.equalsIgnoreCase(enm.text)) {
65 * Returns the {@link NeeoDeviceChannelKind} for the given {@link ChannelKind}
67 * @param kind a non-null {@link ChannelKind}
68 * @return a non-null {@link NeeoDeviceChannelKind}
70 public static NeeoDeviceChannelKind get(ChannelKind kind) {
71 Objects.requireNonNull(kind, "kind cannot be null");
72 return kind == ChannelKind.TRIGGER ? TRIGGER : ITEM;
76 public String toString() {