]> git.basschouten.com Git - openhab-addons.git/blob
903e6f7a48791006b4d34fc5788366e46a0df797
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
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
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.homematic.internal.model;
14
15 /**
16  * Definition of the Homematic paramset types.
17  *
18  * @author Gerhard Riegler - Initial contribution
19  */
20 public enum HmParamsetType {
21     VALUES,
22     MASTER;
23
24     /**
25      * Parses the string and returns the HmParamsetType object.
26      */
27     public static HmParamsetType parse(String type) {
28         if (type != null) {
29             if (type.equals(VALUES.toString()) || type.equals(VALUES.getId())) {
30                 return VALUES;
31             } else if (type.equals(MASTER.toString()) || type.equals(MASTER.getId())) {
32                 return MASTER;
33             }
34         }
35         throw new RuntimeException("Unknown HmParamsetType " + type);
36     }
37
38     /**
39      * Returns the first letter as id of the paramset type.
40      */
41     public String getId() {
42         return name().substring(0, 1);
43     }
44 }