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.hue.internal.api.dto.clip2.enums;
15 import java.util.EnumSet;
18 import org.eclipse.jdt.annotation.NonNullByDefault;
19 import org.eclipse.jdt.annotation.Nullable;
22 * Enum for resource types.
24 * @author Andrew Fiddian-Green - Initial contribution
27 public enum ResourceType {
39 ENTERTAINMENT_CONFIGURATION,
63 public static final Set<ResourceType> SSE_TYPES = EnumSet.of(UPDATE, ADD, DELETE, ERROR);
65 public static ResourceType of(@Nullable String value) {
68 return valueOf(value.toUpperCase());
69 } catch (IllegalArgumentException e) {
73 return ERROR.setUnknownTypeId(value);
76 private @Nullable String unknownTypeId;
78 private ResourceType setUnknownTypeId(@Nullable String value) {
79 unknownTypeId = value;
84 public String toString() {
85 String s = this.name().replace("_", " ");
86 s = s.substring(0, 1).toUpperCase() + s.substring(1).toLowerCase();
87 return unknownTypeId == null ? s : s + String.format(" (%s)", unknownTypeId);