]> git.basschouten.com Git - openhab-addons.git/blob
d0fbe544f0c9a9752b2242a112a93e7b42a25391
[openhab-addons.git] /
1 /**
2  * Copyright 2017-2018 Gregory Moyer and contributors.
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.lametrictime.api.local.model;
17
18 import java.util.SortedMap;
19
20 import com.google.gson.annotations.SerializedName;
21
22 public class Action
23 {
24     private String id;
25     @SerializedName("params")
26     private SortedMap<String, Parameter> parameters;
27
28     public String getId()
29     {
30         return id;
31     }
32
33     public void setId(String id)
34     {
35         this.id = id;
36     }
37
38     public Action withId(String id)
39     {
40         setId(id);
41         return this;
42     }
43
44     public SortedMap<String, Parameter> getParameters()
45     {
46         return parameters;
47     }
48
49     public void setParameters(SortedMap<String, Parameter> parameters)
50     {
51         this.parameters = parameters;
52     }
53
54     public Action withParameters(SortedMap<String, Parameter> parameters)
55     {
56         setParameters(parameters);
57         return this;
58     }
59
60     @Override
61     public int hashCode()
62     {
63         final int prime = 31;
64         int result = 1;
65         result = prime * result + ((id == null) ? 0 : id.hashCode());
66         result = prime * result + ((parameters == null) ? 0 : parameters.hashCode());
67         return result;
68     }
69
70     @Override
71     public boolean equals(Object obj)
72     {
73         if (this == obj)
74         {
75             return true;
76         }
77         if (obj == null)
78         {
79             return false;
80         }
81         if (getClass() != obj.getClass())
82         {
83             return false;
84         }
85         Action other = (Action)obj;
86         if (id == null)
87         {
88             if (other.id != null)
89             {
90                 return false;
91             }
92         }
93         else if (!id.equals(other.id))
94         {
95             return false;
96         }
97         if (parameters == null)
98         {
99             if (other.parameters != null)
100             {
101                 return false;
102             }
103         }
104         else if (!parameters.equals(other.parameters))
105         {
106             return false;
107         }
108         return true;
109     }
110
111     @Override
112     public String toString()
113     {
114         StringBuilder builder = new StringBuilder();
115         builder.append("Action [id=");
116         builder.append(id);
117         builder.append(", parameters=");
118         builder.append(parameters);
119         builder.append("]");
120         return builder.toString();
121     }
122 }