]> git.basschouten.com Git - openhab-addons.git/blob
0d524191a683287ac02cc078d5e0849bdb695586
[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.nest.internal.wwn.dto;
14
15 import java.util.Map;
16
17 /**
18  * The top level WWN data that is sent by Nest.
19  *
20  * @author David Bennett - Initial contribution
21  * @author Wouter Born - Add equals and hashCode methods
22  */
23 public class WWNTopLevelData {
24
25     private WWNDevices devices;
26     private WWNMetadata metadata;
27     private Map<String, WWNStructure> structures;
28
29     public WWNDevices getDevices() {
30         return devices;
31     }
32
33     public WWNMetadata getMetadata() {
34         return metadata;
35     }
36
37     public Map<String, WWNStructure> getStructures() {
38         return structures;
39     }
40
41     @Override
42     public boolean equals(Object obj) {
43         if (this == obj) {
44             return true;
45         }
46         if (obj == null) {
47             return false;
48         }
49         if (getClass() != obj.getClass()) {
50             return false;
51         }
52         WWNTopLevelData other = (WWNTopLevelData) obj;
53         if (devices == null) {
54             if (other.devices != null) {
55                 return false;
56             }
57         } else if (!devices.equals(other.devices)) {
58             return false;
59         }
60         if (metadata == null) {
61             if (other.metadata != null) {
62                 return false;
63             }
64         } else if (!metadata.equals(other.metadata)) {
65             return false;
66         }
67         if (structures == null) {
68             if (other.structures != null) {
69                 return false;
70             }
71         } else if (!structures.equals(other.structures)) {
72             return false;
73         }
74         return true;
75     }
76
77     @Override
78     public int hashCode() {
79         final int prime = 31;
80         int result = 1;
81         result = prime * result + ((devices == null) ? 0 : devices.hashCode());
82         result = prime * result + ((metadata == null) ? 0 : metadata.hashCode());
83         result = prime * result + ((structures == null) ? 0 : structures.hashCode());
84         return result;
85     }
86
87     @Override
88     public String toString() {
89         StringBuilder builder = new StringBuilder();
90         builder.append("TopLevelData [devices=").append(devices).append(", metadata=").append(metadata)
91                 .append(", structures=").append(structures).append("]");
92         return builder.toString();
93     }
94 }