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