]> git.basschouten.com Git - openhab-addons.git/blob
47358d8604979b2479a345099a753135b672c266
[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.io.imperihome.internal.model.param;
14
15 /**
16  * Basic device key/value parameter.
17  *
18  * @author Pepijn de Geus - Initial contribution
19  */
20 public class DeviceParam {
21
22     private ParamType key;
23     private Object value;
24
25     public DeviceParam(ParamType type) {
26         this.key = type;
27     }
28
29     public DeviceParam(ParamType type, Object value) {
30         this.key = type;
31         this.value = value;
32     }
33
34     public ParamType getKey() {
35         return key;
36     }
37
38     public Object getValue() {
39         return value;
40     }
41
42     public void setValue(Object value) {
43         this.value = value;
44     }
45
46     @Override
47     public boolean equals(Object o) {
48         if (this == o) {
49             return true;
50         }
51         if (!(o instanceof DeviceParam)) {
52             return false;
53         }
54
55         DeviceParam that = (DeviceParam) o;
56
57         if (key != that.key) {
58             return false;
59         }
60         return value != null ? value.equals(that.value) : that.value == null;
61     }
62
63     @Override
64     public int hashCode() {
65         return key.hashCode();
66     }
67
68     @Override
69     public String toString() {
70         return "DeviceParam{" + "key=" + key + ", value='" + value + '\'' + '}';
71     }
72 }