2 * Copyright (c) 2010-2023 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_SMARTPLUG;
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 smart plugs of the Verisure System.
26 * @author Jan Gustafsson - Initial contribution
30 public class VerisureSmartPlugsDTO extends VerisureBaseThingDTO {
33 public ThingTypeUID getThingTypeUID() {
34 return THING_TYPE_SMARTPLUG;
38 public int hashCode() {
39 return super.hashCode();
42 @SuppressWarnings("PMD.SimplifyBooleanReturns")
44 public boolean equals(@Nullable Object obj) {
48 if (!super.equals(obj)) {
54 if (getClass() != obj.getClass()) {
60 public static class Smartplug {
62 private Device device = new Device();
63 private @Nullable String currentState;
64 private @Nullable String icon;
65 private boolean isHazardous;
66 @SerializedName("__typename")
67 private @Nullable String typename;
69 public Device getDevice() {
73 public @Nullable String getCurrentState() {
77 public @Nullable String getIcon() {
81 public boolean isHazardous() {
85 public @Nullable String getTypename() {
90 public int hashCode() {
93 String localCurrentState = currentState;
94 result = prime * result + ((localCurrentState == null) ? 0 : localCurrentState.hashCode());
95 result = prime * result + device.hashCode();
96 String localIcon = icon;
97 result = prime * result + ((localIcon == null) ? 0 : localIcon.hashCode());
98 result = prime * result + (isHazardous ? 1231 : 1237);
99 String localTypeName = typename;
100 result = prime * result + ((localTypeName == null) ? 0 : localTypeName.hashCode());
105 public boolean equals(@Nullable Object obj) {
112 if (getClass() != obj.getClass()) {
115 Smartplug other = (Smartplug) obj;
116 String localCurrentState = currentState;
117 if (localCurrentState == null) {
118 if (other.currentState != null) {
121 } else if (!localCurrentState.equals(other.currentState)) {
124 if (!device.equals(other.device)) {
127 String localIcon = icon;
128 if (localIcon == null) {
129 if (other.icon != null) {
132 } else if (!localIcon.equals(other.icon)) {
135 if (isHazardous != other.isHazardous) {
138 String localTypeName = typename;
139 if (localTypeName == null) {
140 if (other.typename != null) {
143 } else if (!localTypeName.equals(other.typename)) {
150 public String toString() {
151 return "Smartplug [device=" + device + ", currentState=" + currentState + ", icon=" + icon
152 + ", isHazardous=" + isHazardous + ", typename=" + typename + "]";