]> git.basschouten.com Git - openhab-addons.git/blob
41ae5190af9d7f681ee3e91fdfe2ae9a7c8db33c
[openhab-addons.git] /
1 /**
2  * Copyright 2017-2018 Gregory Moyer and contributors.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package org.openhab.binding.lametrictime.api.local.model;
17
18 import java.util.Map;
19
20 import com.google.gson.JsonPrimitive;
21 import com.google.gson.annotations.SerializedName;
22
23 public class Widget
24 {
25     private String id;
26     @SerializedName("package")
27     private String packageName;
28     private Integer index;
29     private Map<String, JsonPrimitive> settings;
30
31     public String getId()
32     {
33         return id;
34     }
35
36     public void setId(String id)
37     {
38         this.id = id;
39     }
40
41     public Widget withId(String id)
42     {
43         setId(id);
44         return this;
45     }
46
47     public String getPackageName()
48     {
49         return packageName;
50     }
51
52     public void setPackageName(String packageName)
53     {
54         this.packageName = packageName;
55     }
56
57     public Widget withPackageName(String packageName)
58     {
59         setPackageName(packageName);
60         return this;
61     }
62
63     public Integer getIndex()
64     {
65         return index;
66     }
67
68     public void setIndex(Integer index)
69     {
70         this.index = index;
71     }
72
73     public Widget withIndex(Integer index)
74     {
75         setIndex(index);
76         return this;
77     }
78
79     public Map<String, JsonPrimitive> getSettings()
80     {
81         return settings;
82     }
83
84     public void setSettings(Map<String, JsonPrimitive> settings)
85     {
86         this.settings = settings;
87     }
88
89     public Widget withSettings(Map<String, JsonPrimitive> settings)
90     {
91         setSettings(settings);
92         return this;
93     }
94
95     @Override
96     public int hashCode()
97     {
98         final int prime = 31;
99         int result = 1;
100         result = prime * result + ((id == null) ? 0 : id.hashCode());
101         result = prime * result + ((index == null) ? 0 : index.hashCode());
102         result = prime * result + ((packageName == null) ? 0 : packageName.hashCode());
103         result = prime * result + ((settings == null) ? 0 : settings.hashCode());
104         return result;
105     }
106
107     @Override
108     public boolean equals(Object obj)
109     {
110         if (this == obj)
111         {
112             return true;
113         }
114         if (obj == null)
115         {
116             return false;
117         }
118         if (getClass() != obj.getClass())
119         {
120             return false;
121         }
122         Widget other = (Widget)obj;
123         if (id == null)
124         {
125             if (other.id != null)
126             {
127                 return false;
128             }
129         }
130         else if (!id.equals(other.id))
131         {
132             return false;
133         }
134         if (index == null)
135         {
136             if (other.index != null)
137             {
138                 return false;
139             }
140         }
141         else if (!index.equals(other.index))
142         {
143             return false;
144         }
145         if (packageName == null)
146         {
147             if (other.packageName != null)
148             {
149                 return false;
150             }
151         }
152         else if (!packageName.equals(other.packageName))
153         {
154             return false;
155         }
156         if (settings == null)
157         {
158             if (other.settings != null)
159             {
160                 return false;
161             }
162         }
163         else if (!settings.equals(other.settings))
164         {
165             return false;
166         }
167         return true;
168     }
169
170     @Override
171     public String toString()
172     {
173         StringBuilder builder = new StringBuilder();
174         builder.append("Widget [id=");
175         builder.append(id);
176         builder.append(", packageName=");
177         builder.append(packageName);
178         builder.append(", index=");
179         builder.append(index);
180         builder.append(", settings=");
181         builder.append(settings);
182         builder.append("]");
183         return builder.toString();
184     }
185 }