]> git.basschouten.com Git - openhab-addons.git/blob
d1f3133fe9678f4dc3a9edc4e21d96a85ab3615c
[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.lametrictime.internal.api.local.dto;
14
15 import java.util.Map;
16
17 import com.google.gson.JsonPrimitive;
18 import com.google.gson.annotations.SerializedName;
19
20 /**
21  * Pojo for widget.
22  *
23  * @author Gregory Moyer - Initial contribution
24  */
25 public class Widget {
26     private String id;
27     @SerializedName("package")
28     private String packageName;
29     private Integer index;
30     private Map<String, JsonPrimitive> settings;
31
32     public String getId() {
33         return id;
34     }
35
36     public void setId(String id) {
37         this.id = id;
38     }
39
40     public Widget withId(String id) {
41         setId(id);
42         return this;
43     }
44
45     public String getPackageName() {
46         return packageName;
47     }
48
49     public void setPackageName(String packageName) {
50         this.packageName = packageName;
51     }
52
53     public Widget withPackageName(String packageName) {
54         setPackageName(packageName);
55         return this;
56     }
57
58     public Integer getIndex() {
59         return index;
60     }
61
62     public void setIndex(Integer index) {
63         this.index = index;
64     }
65
66     public Widget withIndex(Integer index) {
67         setIndex(index);
68         return this;
69     }
70
71     public Map<String, JsonPrimitive> getSettings() {
72         return settings;
73     }
74
75     public void setSettings(Map<String, JsonPrimitive> settings) {
76         this.settings = settings;
77     }
78
79     public Widget withSettings(Map<String, JsonPrimitive> settings) {
80         setSettings(settings);
81         return this;
82     }
83
84     @Override
85     public int hashCode() {
86         final int prime = 31;
87         int result = 1;
88         result = prime * result + ((id == null) ? 0 : id.hashCode());
89         result = prime * result + ((index == null) ? 0 : index.hashCode());
90         result = prime * result + ((packageName == null) ? 0 : packageName.hashCode());
91         result = prime * result + ((settings == null) ? 0 : settings.hashCode());
92         return result;
93     }
94
95     @Override
96     public boolean equals(Object obj) {
97         if (this == obj) {
98             return true;
99         }
100         if (obj == null) {
101             return false;
102         }
103         if (getClass() != obj.getClass()) {
104             return false;
105         }
106         Widget other = (Widget) obj;
107         if (id == null) {
108             if (other.id != null) {
109                 return false;
110             }
111         } else if (!id.equals(other.id)) {
112             return false;
113         }
114         if (index == null) {
115             if (other.index != null) {
116                 return false;
117             }
118         } else if (!index.equals(other.index)) {
119             return false;
120         }
121         if (packageName == null) {
122             if (other.packageName != null) {
123                 return false;
124             }
125         } else if (!packageName.equals(other.packageName)) {
126             return false;
127         }
128         if (settings == null) {
129             if (other.settings != null) {
130                 return false;
131             }
132         } else if (!settings.equals(other.settings)) {
133             return false;
134         }
135         return true;
136     }
137
138     @Override
139     public String toString() {
140         StringBuilder builder = new StringBuilder();
141         builder.append("Widget [id=");
142         builder.append(id);
143         builder.append(", packageName=");
144         builder.append(packageName);
145         builder.append(", index=");
146         builder.append(index);
147         builder.append(", settings=");
148         builder.append(settings);
149         builder.append("]");
150         return builder.toString();
151     }
152 }