]> git.basschouten.com Git - openhab-addons.git/blob
f6ba3d95e7e4f4abe84218b58ee72a110dadbad4
[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.dwdunwetter.internal.dto;
14
15 import java.util.Arrays;
16
17 /**
18  * Enum for the urgency of the warning.
19  *
20  * @author Martin Koehler - Initial contribution
21  */
22 public enum Urgency {
23
24     IMMEDIATE("Immediate"),
25     FUTURE("Future"),
26     UNKNOWN("Unknown");
27
28     private final String text;
29
30     private Urgency(String text) {
31         this.text = text;
32     }
33
34     public String getText() {
35         return text;
36     }
37
38     public static Urgency getUrgency(String input) {
39         return Arrays.asList(Urgency.values()).stream().filter(urg -> input.equalsIgnoreCase(urg.getText())).findAny()
40                 .orElse(UNKNOWN);
41     }
42 }