]> git.basschouten.com Git - openhab-addons.git/blob
92ec3817903cc4fad9be602337797795e3d90267
[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.miio.internal.basic;
14
15 import java.util.ArrayList;
16 import java.util.List;
17
18 import org.eclipse.jdt.annotation.NonNullByDefault;
19 import org.eclipse.jdt.annotation.Nullable;
20 import org.openhab.binding.miio.internal.MiIoCommand;
21
22 import com.google.gson.annotations.Expose;
23 import com.google.gson.annotations.SerializedName;
24
25 /**
26  * Mapping devices from json
27  *
28  * @author Marcel Verpaalen - Initial contribution
29  */
30 @NonNullByDefault
31 public class DeviceMapping {
32
33     @SerializedName("id")
34     @Expose
35     private List<String> id = new ArrayList<>();
36     @SerializedName("propertyMethod")
37     @Expose
38     private @Nullable String propertyMethod;
39     @SerializedName("maxProperties")
40     @Expose
41     private @Nullable Integer maxProperties;
42     @SerializedName("channels")
43     @Expose
44     private List<MiIoBasicChannel> miIoBasicChannels = new ArrayList<>();
45     @SerializedName("readmeComment")
46     @Expose
47     private @Nullable String readmeComment;
48     @SerializedName("experimental")
49     @Expose
50     private @Nullable Boolean experimental;
51
52     public List<String> getId() {
53         return id;
54     }
55
56     public void setId(List<String> id) {
57         this.id = id;
58     }
59
60     public String getPropertyMethod() {
61         final String propertyMethod = this.propertyMethod;
62         return propertyMethod != null ? propertyMethod : MiIoCommand.GET_PROPERTY.getCommand();
63     }
64
65     public void setPropertyMethod(String propertyMethod) {
66         this.propertyMethod = propertyMethod;
67     }
68
69     public int getMaxProperties() {
70         final Integer maxProperties = this.maxProperties;
71         return maxProperties != null ? maxProperties.intValue() : 5;
72     }
73
74     public void setMaxProperties(int maxProperties) {
75         this.maxProperties = maxProperties;
76     }
77
78     public List<MiIoBasicChannel> getChannels() {
79         return miIoBasicChannels;
80     }
81
82     public void setChannels(List<MiIoBasicChannel> miIoBasicChannels) {
83         this.miIoBasicChannels = miIoBasicChannels;
84     }
85
86     public String getReadmeComment() {
87         final String readmeComment = this.readmeComment;
88         return (readmeComment != null) ? readmeComment : "";
89     }
90
91     public void setReadmeComment(String readmeComment) {
92         this.readmeComment = readmeComment;
93     }
94
95     public @Nullable Boolean getExperimental() {
96         return experimental;
97     }
98
99     public void setExperimental(Boolean experimental) {
100         this.experimental = experimental;
101     }
102 }