]> git.basschouten.com Git - openhab-addons.git/blob
78137b4225a32bc209b46c67a8d647d4700ce3f7
[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.nobohub.internal.model;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16
17 /**
18  * The target of the {@link OverridePlan}. What it applies to.
19  *
20  * @author Jørgen Austvik - Initial contribution
21  * @author Espen Fossen - Initial contribution
22  */
23 @NonNullByDefault
24 public enum OverrideTarget {
25
26     HUB(0),
27     ZONE(1),
28     COMPONENT(2);
29
30     private final int numValue;
31
32     private OverrideTarget(int numValue) {
33         this.numValue = numValue;
34     }
35
36     public static OverrideTarget getByNumber(int value) throws NoboDataException {
37         switch (value) {
38             case 0:
39                 return HUB;
40             case 1:
41                 return ZONE;
42             case 2:
43                 return COMPONENT;
44             default:
45                 throw new NoboDataException(String.format("Unknown override target %d", value));
46         }
47     }
48
49     public int getNumValue() {
50         return numValue;
51     }
52 }