]> git.basschouten.com Git - openhab-addons.git/blob
028055c4b3cbe215b1b56201aaf680cd0f033293
[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.sleepiq.internal.api.dto;
14
15 import com.google.gson.annotations.SerializedName;
16
17 /**
18  * The {@link Failure} holds the Failure response from the sleepiq API.
19  *
20  * @author Gregory Moyer - Initial contribution
21  */
22 public class Failure {
23     @SerializedName("Error")
24     private Error error;
25
26     public Error getError() {
27         return error;
28     }
29
30     public void setError(Error error) {
31         this.error = error;
32     }
33
34     public Failure withError(Error error) {
35         setError(error);
36         return this;
37     }
38
39     @Override
40     public int hashCode() {
41         final int prime = 31;
42         int result = 1;
43         result = prime * result + ((error == null) ? 0 : error.hashCode());
44         return result;
45     }
46
47     @Override
48     public boolean equals(Object obj) {
49         if (this == obj) {
50             return true;
51         }
52         if (obj == null) {
53             return false;
54         }
55         if (!(obj instanceof Failure)) {
56             return false;
57         }
58         Failure other = (Failure) obj;
59         if (error == null) {
60             if (other.error != null) {
61                 return false;
62             }
63         } else if (!error.equals(other.error)) {
64             return false;
65         }
66         return true;
67     }
68
69     @Override
70     public String toString() {
71         StringBuilder builder = new StringBuilder();
72         builder.append("Failure [error=");
73         builder.append(error);
74         builder.append("]");
75         return builder.toString();
76     }
77 }