]> git.basschouten.com Git - openhab-addons.git/blob
404cf211684416ba4c886d6911a6acc3bf5b745f
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2020 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.gardena.internal.model;
14
15 import java.util.ArrayList;
16 import java.util.List;
17
18 import org.apache.commons.lang.builder.EqualsBuilder;
19 import org.apache.commons.lang.builder.HashCodeBuilder;
20
21 import com.google.gson.annotations.SerializedName;
22
23 /**
24  * Represents a Gardena location.
25  *
26  * @author Gerhard Riegler - Initial contribution
27  */
28 public class Location {
29
30     private String id;
31     private String name;
32     @SerializedName("devices")
33     public List<String> deviceIds = new ArrayList<>();
34
35     /**
36      * Returns the id of the location.
37      */
38     public String getId() {
39         return id;
40     }
41
42     /**
43      * Returns the name of the location.
44      */
45     public String getName() {
46         return name;
47     }
48
49     /**
50      * Returns the device ids of the location.
51      */
52     public List<String> getDeviceIds() {
53         return deviceIds;
54     }
55
56     @Override
57     public int hashCode() {
58         return new HashCodeBuilder().append(id).toHashCode();
59     }
60
61     @Override
62     public boolean equals(Object obj) {
63         if (obj == null || !(obj instanceof Location)) {
64             return false;
65         }
66         Location comp = (Location) obj;
67         return new EqualsBuilder().append(comp.getId(), id).isEquals();
68     }
69 }