]> git.basschouten.com Git - openhab-addons.git/blob
5809d1aa90956c22bee0913154d0736d1c0bf8c7
[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 /**
16  * @author David Bennett - Initial contribution
17  * @author Wouter Born - Extract Where object from Structure
18  * @author Wouter Born - Add equals, hashCode, toString methods
19  */
20 public class WWNWhere {
21     private String whereId;
22     private String name;
23
24     public String getWhereId() {
25         return whereId;
26     }
27
28     public String getName() {
29         return name;
30     }
31
32     @Override
33     public boolean equals(Object obj) {
34         if (this == obj) {
35             return true;
36         }
37         if (obj == null) {
38             return false;
39         }
40         if (getClass() != obj.getClass()) {
41             return false;
42         }
43         WWNWhere other = (WWNWhere) obj;
44         if (name == null) {
45             if (other.name != null) {
46                 return false;
47             }
48         } else if (!name.equals(other.name)) {
49             return false;
50         }
51         if (whereId == null) {
52             if (other.whereId != null) {
53                 return false;
54             }
55         } else if (!whereId.equals(other.whereId)) {
56             return false;
57         }
58         return true;
59     }
60
61     @Override
62     public int hashCode() {
63         final int prime = 31;
64         int result = 1;
65         result = prime * result + ((name == null) ? 0 : name.hashCode());
66         result = prime * result + ((whereId == null) ? 0 : whereId.hashCode());
67         return result;
68     }
69
70     @Override
71     public String toString() {
72         StringBuilder builder = new StringBuilder();
73         builder.append("Where [whereId=").append(whereId).append(", name=").append(name).append("]");
74         return builder.toString();
75     }
76 }