2 * Copyright (c) 2010-2021 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
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
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.verisure.internal.dto;
15 import static org.openhab.binding.verisure.internal.VerisureBindingConstants.THING_TYPE_DOORWINDOW;
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.eclipse.jdt.annotation.Nullable;
19 import org.openhab.core.thing.ThingTypeUID;
21 import com.google.gson.annotations.SerializedName;
24 * The door and window devices of the Verisure System.
26 * @author Jan Gustafsson - Initial contribution
30 public class VerisureDoorWindowsDTO extends VerisureBaseThingDTO {
33 public ThingTypeUID getThingTypeUID() {
34 return THING_TYPE_DOORWINDOW;
38 public int hashCode() {
39 return super.hashCode();
43 public boolean equals(@Nullable Object obj) {
47 if (!super.equals(obj)) {
53 if (getClass() != obj.getClass()) {
59 public static class DoorWindow {
61 private Device device = new Device();
62 private @Nullable String type;
63 private @Nullable String state;
64 private boolean wired;
65 private @Nullable String reportTime;
66 @SerializedName("__typename")
67 private @Nullable String typename;
69 public Device getDevice() {
73 public @Nullable String getType() {
77 public @Nullable String getState() {
81 public boolean getWired() {
85 public @Nullable String getReportTime() {
89 public @Nullable String getTypename() {
94 public int hashCode() {
97 result = prime * result + device.hashCode();
98 String localReportTime = reportTime;
99 result = prime * result + ((localReportTime == null) ? 0 : localReportTime.hashCode());
100 String localState = state;
101 result = prime * result + ((localState == null) ? 0 : localState.hashCode());
102 String localType = type;
103 result = prime * result + ((localType == null) ? 0 : localType.hashCode());
104 String localTypeName = typename;
105 result = prime * result + ((localTypeName == null) ? 0 : localTypeName.hashCode());
106 result = prime * result + (wired ? 1231 : 1237);
111 public boolean equals(@Nullable Object obj) {
118 if (getClass() != obj.getClass()) {
121 DoorWindow other = (DoorWindow) obj;
122 if (!device.equals(other.device)) {
125 String localReportTime = reportTime;
126 if (localReportTime == null) {
127 if (other.reportTime != null) {
130 } else if (!localReportTime.equals(other.reportTime)) {
133 String localState = state;
134 if (localState == null) {
135 if (other.state != null) {
138 } else if (!localState.equals(other.state)) {
141 String localType = type;
142 if (localType == null) {
143 if (other.type != null) {
146 } else if (!localType.equals(other.type)) {
149 String localTypeName = typename;
150 if (localTypeName == null) {
151 if (other.typename != null) {
154 } else if (!localTypeName.equals(other.typename)) {
157 if (wired != other.wired) {
164 public String toString() {
165 return "DoorWindow [device=" + device + ", type=" + type + ", state=" + state + ", wired=" + wired
166 + ", reportTime=" + reportTime + ", typename=" + typename + "]";