]> git.basschouten.com Git - openhab-addons.git/blob
de89355ff89fa1a9cf9b49a3bb034898e695eafa
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2022 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.zoneminder.internal.handler;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.eclipse.jdt.annotation.Nullable;
17
18 /**
19  * The {@link MonitorFunction} represents the valid functions for a Zoneminder monitor.
20  *
21  * @author Mark Hilbush - Initial contribution
22  */
23 @NonNullByDefault
24 public enum MonitorFunction {
25
26     NONE("None"),
27     MONITOR("Monitor"),
28     MODECT("Modect"),
29     RECORD("Record"),
30     MOCORD("Mocord"),
31     NODECT("Nodect");
32
33     private final String type;
34
35     private MonitorFunction(String type) {
36         this.type = type;
37     }
38
39     public static MonitorFunction forValue(@Nullable String v) {
40         if (v != null) {
41             for (MonitorFunction at : MonitorFunction.values()) {
42                 if (at.type.equals(v)) {
43                     return at;
44                 }
45             }
46         }
47         throw new IllegalArgumentException(String.format("Invalid or null monitor function: %s" + v));
48     }
49
50     @Override
51     public String toString() {
52         return this.type;
53     }
54 }