]> git.basschouten.com Git - openhab-addons.git/blob
4168740bc5e03d98fe06d1f7ad7b93153cb015ca
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2022 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 /**
16  * The top level WWN data that is sent by Nest to a streaming REST client using SSE.
17  *
18  * @author Wouter Born - Initial contribution
19  * @author Wouter Born - Replace polling with REST streaming
20  * @author Wouter Born - Add equals and hashCode methods
21  */
22 public class WWNTopLevelStreamingData {
23
24     private String path;
25     private WWNTopLevelData data;
26
27     public String getPath() {
28         return path;
29     }
30
31     public WWNTopLevelData getData() {
32         return data;
33     }
34
35     @Override
36     public int hashCode() {
37         final int prime = 31;
38         int result = 1;
39         result = prime * result + ((data == null) ? 0 : data.hashCode());
40         result = prime * result + ((path == null) ? 0 : path.hashCode());
41         return result;
42     }
43
44     @Override
45     public boolean equals(Object obj) {
46         if (this == obj) {
47             return true;
48         }
49         if (obj == null) {
50             return false;
51         }
52         if (getClass() != obj.getClass()) {
53             return false;
54         }
55         WWNTopLevelStreamingData other = (WWNTopLevelStreamingData) obj;
56         if (data == null) {
57             if (other.data != null) {
58                 return false;
59             }
60         } else if (!data.equals(other.data)) {
61             return false;
62         }
63         if (path == null) {
64             if (other.path != null) {
65                 return false;
66             }
67         } else if (!path.equals(other.path)) {
68             return false;
69         }
70         return true;
71     }
72
73     @Override
74     public String toString() {
75         StringBuilder builder = new StringBuilder();
76         builder.append("TopLevelStreamingData [path=").append(path).append(", data=").append(data).append("]");
77         return builder.toString();
78     }
79 }