]> git.basschouten.com Git - openhab-addons.git/blob
ada22e4ede4d37bda44d006ce973553bd2c931a6
[openhab-addons.git] /
1 /**
2  * Copyright 2017-2018 Gregory Moyer and contributors.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package org.openhab.binding.lametrictime.api.model.enums;
17
18 import org.openhab.binding.lametrictime.api.model.ApiValue;
19
20 public enum DisplayType implements ApiValue
21 {
22     MONOCHROME,
23     GRAYSCALE,
24     COLOR,
25     MIXED;
26
27     @Override
28     public String toRaw()
29     {
30         return name().toLowerCase();
31     }
32
33     public static DisplayType toEnum(String raw)
34     {
35         if (raw == null)
36         {
37             return null;
38         }
39
40         try
41         {
42             return valueOf(raw.toUpperCase());
43         }
44         catch (IllegalArgumentException e)
45         {
46             // not a valid raw string
47             return null;
48         }
49     }
50 }