]> git.basschouten.com Git - openhab-addons.git/blob
6865067ae1b29ca664c7d856dc7f09690407c657
[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 Error} holds the Error response from the sleepiq API.
19  *
20  * @author Gregory Moyer - Initial contribution
21  */
22 public class Error {
23     @SerializedName("Code")
24     private Long code;
25     @SerializedName("Message")
26     private String message;
27
28     public Long getCode() {
29         return code;
30     }
31
32     public void setCode(Long code) {
33         this.code = code;
34     }
35
36     public Error withCode(Long code) {
37         setCode(code);
38         return this;
39     }
40
41     public String getMessage() {
42         return message;
43     }
44
45     public void setMessage(String message) {
46         this.message = message;
47     }
48
49     public Error withMessage(String message) {
50         setMessage(message);
51         return this;
52     }
53
54     @Override
55     public int hashCode() {
56         final int prime = 31;
57         int result = 1;
58         result = prime * result + ((code == null) ? 0 : code.hashCode());
59         return result;
60     }
61
62     @Override
63     public boolean equals(Object obj) {
64         if (this == obj) {
65             return true;
66         }
67         if (obj == null) {
68             return false;
69         }
70         if (!(obj instanceof Error)) {
71             return false;
72         }
73         Error other = (Error) obj;
74         if (code == null) {
75             if (other.code != null) {
76                 return false;
77             }
78         } else if (!code.equals(other.code)) {
79             return false;
80         }
81         return true;
82     }
83
84     @Override
85     public String toString() {
86         StringBuilder builder = new StringBuilder();
87         builder.append("Error [code=");
88         builder.append(code);
89         builder.append(", message=");
90         builder.append(message);
91         builder.append("]");
92         return builder.toString();
93     }
94 }