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;
22 * Immutable POJO representing the device identification queried from the Miele REST API.
24 * @author Björn Lange - Initial contribution
31 private String deviceName;
33 private DeviceIdentLabel deviceIdentLabel;
35 private XkmIdentLabel xkmIdentLabel;
37 public Optional<Type> getType() {
38 return Optional.ofNullable(type);
41 public Optional<String> getDeviceName() {
42 return Optional.ofNullable(deviceName);
45 public Optional<DeviceIdentLabel> getDeviceIdentLabel() {
46 return Optional.ofNullable(deviceIdentLabel);
49 public Optional<XkmIdentLabel> getXkmIdentLabel() {
50 return Optional.ofNullable(xkmIdentLabel);
54 public int hashCode() {
55 return Objects.hash(deviceIdentLabel, deviceName, type, xkmIdentLabel);
59 public boolean equals(@Nullable Object obj) {
66 if (getClass() != obj.getClass()) {
69 Ident other = (Ident) obj;
70 return Objects.equals(deviceIdentLabel, other.deviceIdentLabel) && Objects.equals(deviceName, other.deviceName)
71 && Objects.equals(type, other.type) && Objects.equals(xkmIdentLabel, other.xkmIdentLabel);
75 public String toString() {
76 return "Ident [type=" + type + ", deviceName=" + deviceName + ", deviceIdentLabel=" + deviceIdentLabel
77 + ", xkmIdentLabel=" + xkmIdentLabel + "]";