2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
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
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.mielecloud.internal.webservice.api.json;
15 import java.util.Objects;
16 import java.util.Optional;
18 import org.eclipse.jdt.annotation.NonNullByDefault;
19 import org.eclipse.jdt.annotation.Nullable;
21 import com.google.gson.annotations.SerializedName;
24 * Immutable POJO representing the type of a device. Queried from the Miele REST API.
26 * @author Björn Lange - Initial contribution
30 @SerializedName("key_localized")
32 private String keyLocalized;
33 @SerializedName("value_raw")
35 private DeviceType valueRaw;
36 @SerializedName("value_localized")
38 private String valueLocalized;
40 public Optional<String> getKeyLocalized() {
41 return Optional.ofNullable(keyLocalized);
44 public DeviceType getValueRaw() {
45 return Optional.ofNullable(valueRaw).orElse(DeviceType.UNKNOWN);
48 public Optional<String> getValueLocalized() {
49 return Optional.ofNullable(valueLocalized);
53 public int hashCode() {
54 return Objects.hash(keyLocalized, valueLocalized, valueRaw);
58 public boolean equals(@Nullable Object obj) {
65 if (getClass() != obj.getClass()) {
68 Type other = (Type) obj;
69 return Objects.equals(keyLocalized, other.keyLocalized) && Objects.equals(valueLocalized, other.valueLocalized)
70 && valueRaw == other.valueRaw;
74 public String toString() {
75 return "Type [keyLocalized=" + keyLocalized + ", valueRaw=" + valueRaw + ", valueLocalized=" + valueLocalized