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.nest.internal.wwn.dto;
16 * The data of WWN API errors.
18 * @author Wouter Born - Initial contribution
19 * @author Wouter Born - Improve exception handling
20 * @author Wouter Born - Add equals and hashCode methods
22 public class WWNErrorData {
26 private String message;
27 private String instance;
29 public String getError() {
33 public String getType() {
37 public String getMessage() {
41 public String getInstance() {
46 public boolean equals(Object obj) {
53 if (getClass() != obj.getClass()) {
56 WWNErrorData other = (WWNErrorData) obj;
58 if (other.error != null) {
61 } else if (!error.equals(other.error)) {
64 if (instance == null) {
65 if (other.instance != null) {
68 } else if (!instance.equals(other.instance)) {
71 if (message == null) {
72 if (other.message != null) {
75 } else if (!message.equals(other.message)) {
79 if (other.type != null) {
82 } else if (!type.equals(other.type)) {
89 public int hashCode() {
92 result = prime * result + ((error == null) ? 0 : error.hashCode());
93 result = prime * result + ((instance == null) ? 0 : instance.hashCode());
94 result = prime * result + ((message == null) ? 0 : message.hashCode());
95 result = prime * result + ((type == null) ? 0 : type.hashCode());
100 public String toString() {
101 StringBuilder builder = new StringBuilder();
102 builder.append("ErrorData [error=").append(error).append(", type=").append(type).append(", message=")
103 .append(message).append(", instance=").append(instance).append("]");
104 return builder.toString();