]> git.basschouten.com Git - openhab-addons.git/blob
5593b59fe42d1f994a32652a403303f846e740a8
[openhab-addons.git] /
1 /*
2  * Copyright 2017 Gregory Moyer
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package org.openhab.binding.sleepiq.api.model;
17
18 import com.google.gson.annotations.SerializedName;
19
20 public class Error
21 {
22     @SerializedName("Code")
23     private Long code;
24     @SerializedName("Message")
25     private String message;
26
27     public Long getCode()
28     {
29         return code;
30     }
31
32     public void setCode(Long code)
33     {
34         this.code = code;
35     }
36
37     public Error withCode(Long code)
38     {
39         setCode(code);
40         return this;
41     }
42
43     public String getMessage()
44     {
45         return message;
46     }
47
48     public void setMessage(String message)
49     {
50         this.message = message;
51     }
52
53     public Error withMessage(String message)
54     {
55         setMessage(message);
56         return this;
57     }
58
59     @Override
60     public int hashCode()
61     {
62         final int prime = 31;
63         int result = 1;
64         result = prime * result + ((code == null) ? 0 : code.hashCode());
65         return result;
66     }
67
68     @Override
69     public boolean equals(Object obj)
70     {
71         if (this == obj)
72         {
73             return true;
74         }
75         if (obj == null)
76         {
77             return false;
78         }
79         if (!(obj instanceof Error))
80         {
81             return false;
82         }
83         Error other = (Error)obj;
84         if (code == null)
85         {
86             if (other.code != null)
87             {
88                 return false;
89             }
90         }
91         else if (!code.equals(other.code))
92         {
93             return false;
94         }
95         return true;
96     }
97
98     @Override
99     public String toString()
100     {
101         StringBuilder builder = new StringBuilder();
102         builder.append("Error [code=");
103         builder.append(code);
104         builder.append(", message=");
105         builder.append(message);
106         builder.append("]");
107         return builder.toString();
108     }
109 }