]> git.basschouten.com Git - openhab-addons.git/blob
ea7c44b11f3ad6ecdb64cf1ed5f3c365675aa63c
[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.mielecloud.internal.webservice.api.json;
14
15 import java.util.Objects;
16 import java.util.Optional;
17
18 import org.eclipse.jdt.annotation.NonNullByDefault;
19 import org.eclipse.jdt.annotation.Nullable;
20
21 import com.google.gson.annotations.SerializedName;
22
23 /**
24  * Immutable POJO representing the program type that is currently running. Queried from the Miele REST API.
25  *
26  * @author Roland Edelhoff - Initial contribution
27  */
28 @NonNullByDefault
29 public class ProgramId {
30     @SerializedName("value_raw")
31     @Nullable
32     private Long valueRaw;
33     @SerializedName("value_localized")
34     @Nullable
35     private String valueLocalized;
36     @SerializedName("key_localized")
37     @Nullable
38     private String keyLocalized;
39
40     public Optional<Long> getValueRaw() {
41         return Optional.ofNullable(valueRaw);
42     }
43
44     public Optional<String> getValueLocalized() {
45         return Optional.ofNullable(valueLocalized);
46     }
47
48     public Optional<String> getKeyLocalized() {
49         return Optional.ofNullable(keyLocalized);
50     }
51
52     @Override
53     public int hashCode() {
54         return Objects.hash(keyLocalized, valueLocalized, valueRaw);
55     }
56
57     @Override
58     public boolean equals(@Nullable Object obj) {
59         if (this == obj) {
60             return true;
61         }
62         if (obj == null) {
63             return false;
64         }
65         if (getClass() != obj.getClass()) {
66             return false;
67         }
68         ProgramId other = (ProgramId) obj;
69         return Objects.equals(keyLocalized, other.keyLocalized) && Objects.equals(valueLocalized, other.valueLocalized)
70                 && Objects.equals(valueRaw, other.valueRaw);
71     }
72
73     @Override
74     public String toString() {
75         return "ProgramType [valueRaw=" + valueRaw + ", valueLocalized=" + valueLocalized + ", keyLocalized="
76                 + keyLocalized + "]";
77     }
78 }