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.deconz.internal.types;
15 import java.util.Arrays;
17 import java.util.stream.Collectors;
19 import org.eclipse.jdt.annotation.NonNullByDefault;
20 import org.slf4j.Logger;
21 import org.slf4j.LoggerFactory;
24 * Type of a group as reported by the REST API for usage in {@link org.openhab.binding.deconz.internal.dto.LightMessage}
26 * @author Jan N. Klug - Initial contribution
29 public enum GroupType {
30 LIGHT_GROUP("LightGroup"),
33 private static final Map<String, GroupType> MAPPING = Arrays.stream(GroupType.values())
34 .collect(Collectors.toMap(v -> v.type, v -> v));
35 private static final Logger LOGGER = LoggerFactory.getLogger(GroupType.class);
39 GroupType(String type) {
43 public static GroupType fromString(String s) {
44 GroupType lightType = MAPPING.getOrDefault(s, UNKNOWN);
45 if (lightType == UNKNOWN) {
46 LOGGER.debug("Unknown group type '{}' found. This should be reported.", s);