]> git.basschouten.com Git - openhab-addons.git/blob
e29eaba8219413365c03e61a5426a1c31234b782
[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.verisure.internal.dto;
14
15 import static org.openhab.binding.verisure.internal.VerisureBindingConstants.THING_TYPE_BROADBAND_CONNECTION;
16
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.eclipse.jdt.annotation.Nullable;
19 import org.openhab.core.thing.ThingTypeUID;
20
21 import com.google.gson.annotations.SerializedName;
22
23 /**
24  * The broadband connections of the Verisure System.
25  *
26  * @author Jan Gustafsson - Initial contribution
27  *
28  */
29 @NonNullByDefault
30 public class VerisureBroadbandConnectionsDTO extends VerisureBaseThingDTO {
31
32     @Override
33     public ThingTypeUID getThingTypeUID() {
34         return THING_TYPE_BROADBAND_CONNECTION;
35     }
36
37     @Override
38     public int hashCode() {
39         return super.hashCode();
40     }
41
42     @Override
43     public boolean equals(@Nullable Object obj) {
44         if (this == obj) {
45             return true;
46         }
47         if (!super.equals(obj)) {
48             return false;
49         }
50         if (obj == null) {
51             return false;
52         }
53         if (getClass() != obj.getClass()) {
54             return false;
55         }
56         return true;
57     }
58
59     public static class Broadband {
60
61         private @Nullable String testDate;
62         private boolean isBroadbandConnected;
63         @SerializedName("__typename")
64         private @Nullable String typename;
65
66         public @Nullable String getTestDate() {
67             return testDate;
68         }
69
70         public boolean isBroadbandConnected() {
71             return isBroadbandConnected;
72         }
73
74         public @Nullable String getTypename() {
75             return typename;
76         }
77
78         @Override
79         public int hashCode() {
80             final int prime = 31;
81             int result = 1;
82             result = prime * result + (isBroadbandConnected ? 1231 : 1237);
83             String localTestDate = testDate;
84             result = prime * result + ((localTestDate == null) ? 0 : localTestDate.hashCode());
85             String localTypeName = typename;
86             result = prime * result + ((localTypeName == null) ? 0 : localTypeName.hashCode());
87             return result;
88         }
89
90         @Override
91         public boolean equals(@Nullable Object obj) {
92             if (this == obj) {
93                 return true;
94             }
95             if (obj == null) {
96                 return false;
97             }
98             if (getClass() != obj.getClass()) {
99                 return false;
100             }
101             Broadband other = (Broadband) obj;
102             if (isBroadbandConnected != other.isBroadbandConnected) {
103                 return false;
104             }
105             String localTestDate = testDate;
106             if (localTestDate == null) {
107                 if (other.testDate != null) {
108                     return false;
109                 }
110             } else if (!localTestDate.equals(other.testDate)) {
111                 return false;
112             }
113             String localTypeName = typename;
114             if (localTypeName == null) {
115                 if (other.typename != null) {
116                     return false;
117                 }
118             } else if (!localTypeName.equals(other.typename)) {
119                 return false;
120             }
121             return true;
122         }
123
124         @Override
125         public String toString() {
126             return "Broadband [testDate=" + testDate + ", isBroadbandConnected=" + isBroadbandConnected + ", typename="
127                     + typename + "]";
128         }
129     }
130 }