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.Collections;
16 import java.util.List;
17 import java.util.Objects;
18 import java.util.Optional;
20 import org.eclipse.jdt.annotation.NonNullByDefault;
21 import org.eclipse.jdt.annotation.Nullable;
24 * Immutable POJO representing the full device identification queried from the Miele REST API.
26 * @author Björn Lange - Initial contribution
29 public class DeviceIdentLabel {
31 private String fabNumber;
33 private String fabIndex;
35 private String techType;
37 private String matNumber;
39 private final List<String> swids = null;
41 public Optional<String> getFabNumber() {
42 return Optional.ofNullable(fabNumber);
45 public Optional<String> getFabIndex() {
46 return Optional.ofNullable(fabIndex);
49 public Optional<String> getTechType() {
50 return Optional.ofNullable(techType);
53 public Optional<String> getMatNumber() {
54 return Optional.ofNullable(matNumber);
57 public List<String> getSwids() {
59 return Collections.emptyList();
62 return Collections.unmodifiableList(swids);
66 public int hashCode() {
67 return Objects.hash(fabIndex, fabNumber, matNumber, swids, techType);
71 public boolean equals(@Nullable Object obj) {
78 if (getClass() != obj.getClass()) {
81 DeviceIdentLabel other = (DeviceIdentLabel) obj;
82 return Objects.equals(fabIndex, other.fabIndex) && Objects.equals(fabNumber, other.fabNumber)
83 && Objects.equals(matNumber, other.matNumber) && Objects.equals(swids, other.swids)
84 && Objects.equals(techType, other.techType);
88 public String toString() {
89 return "DeviceIdentLabel [fabNumber=" + fabNumber + ", fabIndex=" + fabIndex + ", techType=" + techType
90 + ", matNumber=" + matNumber + ", swids=" + swids + "]";