]> git.basschouten.com Git - openhab-addons.git/blob
0db463882aaabcf0a7953b820d72d502010ddcf9
[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_GATEWAY;
16
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.eclipse.jdt.annotation.Nullable;
19 import org.openhab.core.thing.ThingTypeUID;
20
21 /**
22  * The gateway in the Verisure System.
23  *
24  * @author Jan Gustafsson - Initial contribution
25  *
26  */
27 @NonNullByDefault
28 public class VerisureGatewayDTO extends VerisureBaseThingDTO {
29
30     @Override
31     public ThingTypeUID getThingTypeUID() {
32         return THING_TYPE_GATEWAY;
33     }
34
35     @Override
36     public int hashCode() {
37         return super.hashCode();
38     }
39
40     @SuppressWarnings("PMD.SimplifyBooleanReturns")
41     @Override
42     public boolean equals(@Nullable Object obj) {
43         if (this == obj) {
44             return true;
45         }
46         if (!super.equals(obj)) {
47             return false;
48         }
49         if (obj == null) {
50             return false;
51         }
52         if (getClass() != obj.getClass()) {
53             return false;
54         }
55         return true;
56     }
57
58     public static class CommunicationState {
59
60         private @Nullable String hardwareCarrierType;
61         private @Nullable String result;
62         private @Nullable String mediaType;
63         private Device device = new Device();
64         private @Nullable String testDate;
65         private @Nullable String typename;
66
67         public @Nullable String getHardwareCarrierType() {
68             return hardwareCarrierType;
69         }
70
71         public @Nullable String getResult() {
72             return result;
73         }
74
75         public @Nullable String getMediaType() {
76             return mediaType;
77         }
78
79         public Device getDevice() {
80             return device;
81         }
82
83         public @Nullable String getTestDate() {
84             return testDate;
85         }
86
87         public @Nullable String getTypename() {
88             return typename;
89         }
90
91         @Override
92         public int hashCode() {
93             final int prime = 31;
94             int result = 1;
95             result = prime * result + device.hashCode();
96             String locaHardwareCarrierType = hardwareCarrierType;
97             result = prime * result + ((locaHardwareCarrierType == null) ? 0 : locaHardwareCarrierType.hashCode());
98             String localMediaType = mediaType;
99             result = prime * result + ((localMediaType == null) ? 0 : localMediaType.hashCode());
100             String localResult = this.result;
101             result = prime * result + ((localResult == null) ? 0 : localResult.hashCode());
102             String localTestDate = testDate;
103             result = prime * result + ((localTestDate == null) ? 0 : localTestDate.hashCode());
104             String localTypeName = typename;
105             result = prime * result + ((localTypeName == null) ? 0 : localTypeName.hashCode());
106             return result;
107         }
108
109         @Override
110         public boolean equals(@Nullable Object obj) {
111             if (this == obj) {
112                 return true;
113             }
114             if (obj == null) {
115                 return false;
116             }
117             if (getClass() != obj.getClass()) {
118                 return false;
119             }
120             CommunicationState other = (CommunicationState) obj;
121             if (!device.equals(other.device)) {
122                 return false;
123             }
124             String locaHardwareCarrierType = hardwareCarrierType;
125             if (locaHardwareCarrierType == null) {
126                 if (other.hardwareCarrierType != null) {
127                     return false;
128                 }
129             } else if (!locaHardwareCarrierType.equals(other.hardwareCarrierType)) {
130                 return false;
131             }
132             String localMediaType = mediaType;
133             if (localMediaType == null) {
134                 if (other.mediaType != null) {
135                     return false;
136                 }
137             } else if (!localMediaType.equals(other.mediaType)) {
138                 return false;
139             }
140             String localResult = result;
141             if (localResult == null) {
142                 if (other.result != null) {
143                     return false;
144                 }
145             } else if (!localResult.equals(other.result)) {
146                 return false;
147             }
148             String localTestDate = testDate;
149             if (localTestDate == null) {
150                 if (other.testDate != null) {
151                     return false;
152                 }
153             } else if (!localTestDate.equals(other.testDate)) {
154                 return false;
155             }
156             String localTypeName = typename;
157             if (localTypeName == null) {
158                 if (other.typename != null) {
159                     return false;
160                 }
161             } else if (!localTypeName.equals(other.typename)) {
162                 return false;
163             }
164             return true;
165         }
166
167         @Override
168         public String toString() {
169             return "CommunicationState [hardwareCarrierType=" + hardwareCarrierType + ", result=" + result
170                     + ", mediaType=" + mediaType + ", device=" + device + ", testDate=" + testDate + ", typename="
171                     + typename + "]";
172         }
173     }
174 }