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.rotel.internal.protocol;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.binding.rotel.internal.RotelException;
19 * Represents the different kinds of protocols
21 * @author Laurent Garnier - Initial contribution
24 public enum RotelProtocol {
35 * @param name the protocol name
37 private RotelProtocol(String name) {
42 * Get the protocol name
44 * @return the protocol name
46 public String getName() {
51 * Get the protocol associated to a name
53 * @param name the name used to identify the protocol
55 * @return the protocol associated to the searched name
57 * @throws RotelException - If no protocol is associated to the searched name
59 public static RotelProtocol getFromName(String name) throws RotelException {
60 for (RotelProtocol value : RotelProtocol.values()) {
61 if (value.getName().equals(name)) {
65 throw new RotelException("Invalid protocol name: " + name);