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.binding.dscalarm.internal.handler;
15 import java.util.HashMap;
19 * Used to map thing types from the binding string to an ENUM value.
21 * @author Russell Stephens - Initial Contribution
23 public enum DSCAlarmThingType {
25 PARTITION("partition"),
32 * Lookup map to get a DSCAlarmDeviceType from its label.
34 private static Map<String, DSCAlarmThingType> labelToDSCAlarmThingType;
41 private DSCAlarmThingType(String label) {
46 * Creates a HashMap that maps the string label to a DSCAlarmDeviceType enum value.
48 private static void initMapping() {
49 labelToDSCAlarmThingType = new HashMap<>();
50 for (DSCAlarmThingType s : values()) {
51 labelToDSCAlarmThingType.put(s.label, s);
56 * Returns the label of the DSCAlarmItemType Values enumeration.
60 public String getLabel() {
65 * Lookup function based on the binding type label. Returns null if the binding type is not found.
70 public static DSCAlarmThingType getDSCAlarmThingType(String label) {
71 if (labelToDSCAlarmThingType == null) {
74 return labelToDSCAlarmThingType.get(label);