]> git.basschouten.com Git - openhab-addons.git/blob
4ab0481e8a4ac8f37ec1afe87effb3d72edcac1a
[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 Failure
21 {
22     @SerializedName("Error")
23     private Error error;
24
25     public Error getError()
26     {
27         return error;
28     }
29
30     public void setError(Error error)
31     {
32         this.error = error;
33     }
34
35     public Failure withError(Error error)
36     {
37         setError(error);
38         return this;
39     }
40
41     @Override
42     public int hashCode()
43     {
44         final int prime = 31;
45         int result = 1;
46         result = prime * result + ((error == null) ? 0 : error.hashCode());
47         return result;
48     }
49
50     @Override
51     public boolean equals(Object obj)
52     {
53         if (this == obj)
54         {
55             return true;
56         }
57         if (obj == null)
58         {
59             return false;
60         }
61         if (!(obj instanceof Failure))
62         {
63             return false;
64         }
65         Failure other = (Failure)obj;
66         if (error == null)
67         {
68             if (other.error != null)
69             {
70                 return false;
71             }
72         }
73         else if (!error.equals(other.error))
74         {
75             return false;
76         }
77         return true;
78     }
79
80     @Override
81     public String toString()
82     {
83         StringBuilder builder = new StringBuilder();
84         builder.append("Failure [error=");
85         builder.append(error);
86         builder.append("]");
87         return builder.toString();
88     }
89 }