]> git.basschouten.com Git - openhab-addons.git/blob
dd0ca2a52f20ea9cd2cf07b93e33c40652b94476
[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 types.
17  *
18  * @author Gerhard Riegler - Initial contribution
19  */
20 public enum HmValueType {
21     BOOL,
22     ACTION,
23     FLOAT,
24     INTEGER,
25     ENUM,
26     STRING,
27     UNKNOWN,
28     DATETIME;
29
30     /**
31      * Parses the string and returns the HmType object.
32      */
33     public static HmValueType parse(String type) {
34         if (type == null) {
35             return UNKNOWN;
36         } else if (BOOL.toString().equals(type)) {
37             return BOOL;
38         } else if (ACTION.toString().equals(type)) {
39             return ACTION;
40         } else if (FLOAT.toString().equals(type)) {
41             return FLOAT;
42         } else if (INTEGER.toString().equals(type)) {
43             return INTEGER;
44         } else if (ENUM.toString().equals(type)) {
45             return ENUM;
46         } else if (STRING.toString().equals(type)) {
47             return STRING;
48         } else if (DATETIME.toString().equals(type)) {
49             return DATETIME;
50         } else {
51             return UNKNOWN;
52         }
53     }
54 }