]> git.basschouten.com Git - openhab-addons.git/blob
6dd0a2641811fd55aedabdad9b7abe5c384b2642
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2022 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     @Override
41     public boolean equals(@Nullable Object obj) {
42         if (this == obj) {
43             return true;
44         }
45         if (!super.equals(obj)) {
46             return false;
47         }
48         if (obj == null) {
49             return false;
50         }
51         if (getClass() != obj.getClass()) {
52             return false;
53         }
54         return true;
55     }
56
57     public static class CommunicationState {
58
59         private @Nullable String hardwareCarrierType;
60         private @Nullable String result;
61         private @Nullable String mediaType;
62         private Device device = new Device();
63         private @Nullable String testDate;
64         private @Nullable String typename;
65
66         public @Nullable String getHardwareCarrierType() {
67             return hardwareCarrierType;
68         }
69
70         public @Nullable String getResult() {
71             return result;
72         }
73
74         public @Nullable String getMediaType() {
75             return mediaType;
76         }
77
78         public Device getDevice() {
79             return device;
80         }
81
82         public @Nullable String getTestDate() {
83             return testDate;
84         }
85
86         public @Nullable String getTypename() {
87             return typename;
88         }
89
90         @Override
91         public int hashCode() {
92             final int prime = 31;
93             int result = 1;
94             result = prime * result + device.hashCode();
95             String locaHardwareCarrierType = hardwareCarrierType;
96             result = prime * result + ((locaHardwareCarrierType == null) ? 0 : locaHardwareCarrierType.hashCode());
97             String localMediaType = mediaType;
98             result = prime * result + ((localMediaType == null) ? 0 : localMediaType.hashCode());
99             String localResult = this.result;
100             result = prime * result + ((localResult == null) ? 0 : localResult.hashCode());
101             String localTestDate = testDate;
102             result = prime * result + ((localTestDate == null) ? 0 : localTestDate.hashCode());
103             String localTypeName = typename;
104             result = prime * result + ((localTypeName == null) ? 0 : localTypeName.hashCode());
105             return result;
106         }
107
108         @Override
109         public boolean equals(@Nullable Object obj) {
110             if (this == obj) {
111                 return true;
112             }
113             if (obj == null) {
114                 return false;
115             }
116             if (getClass() != obj.getClass()) {
117                 return false;
118             }
119             CommunicationState other = (CommunicationState) obj;
120             if (!device.equals(other.device)) {
121                 return false;
122             }
123             String locaHardwareCarrierType = hardwareCarrierType;
124             if (locaHardwareCarrierType == null) {
125                 if (other.hardwareCarrierType != null) {
126                     return false;
127                 }
128             } else if (!locaHardwareCarrierType.equals(other.hardwareCarrierType)) {
129                 return false;
130             }
131             String localMediaType = mediaType;
132             if (localMediaType == null) {
133                 if (other.mediaType != null) {
134                     return false;
135                 }
136             } else if (!localMediaType.equals(other.mediaType)) {
137                 return false;
138             }
139             String localResult = result;
140             if (localResult == null) {
141                 if (other.result != null) {
142                     return false;
143                 }
144             } else if (!localResult.equals(other.result)) {
145                 return false;
146             }
147             String localTestDate = testDate;
148             if (localTestDate == null) {
149                 if (other.testDate != null) {
150                     return false;
151                 }
152             } else if (!localTestDate.equals(other.testDate)) {
153                 return false;
154             }
155             String localTypeName = typename;
156             if (localTypeName == null) {
157                 if (other.typename != null) {
158                     return false;
159                 }
160             } else if (!localTypeName.equals(other.typename)) {
161                 return false;
162             }
163             return true;
164         }
165
166         @Override
167         public String toString() {
168             return "CommunicationState [hardwareCarrierType=" + hardwareCarrierType + ", result=" + result
169                     + ", mediaType=" + mediaType + ", device=" + device + ", testDate=" + testDate + ", typename="
170                     + typename + "]";
171         }
172     }
173 }