]> git.basschouten.com Git - openhab-addons.git/blob
e597415e2b1610e03731159b3b73332b9982754f
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2020 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
46     public List<String> getId() {
47         return id;
48     }
49
50     public void setId(List<String> id) {
51         this.id = id;
52     }
53
54     public String getPropertyMethod() {
55         final String propertyMethod = this.propertyMethod;
56         return propertyMethod != null ? propertyMethod : MiIoCommand.GET_PROPERTY.getCommand();
57     }
58
59     public void setPropertyMethod(String propertyMethod) {
60         this.propertyMethod = propertyMethod;
61     }
62
63     public int getMaxProperties() {
64         final Integer maxProperties = this.maxProperties;
65         return maxProperties != null ? maxProperties.intValue() : 5;
66     }
67
68     public void setMaxProperties(int maxProperties) {
69         this.maxProperties = maxProperties;
70     }
71
72     public List<MiIoBasicChannel> getChannels() {
73         return miIoBasicChannels;
74     }
75
76     public void setChannels(List<MiIoBasicChannel> miIoBasicChannels) {
77         this.miIoBasicChannels = miIoBasicChannels;
78     }
79 }