]> git.basschouten.com Git - openhab-addons.git/blob
c1025fb00991adf461a0c9b8713bb3e766b061e2
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2021 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.unifi.internal.api.model;
14
15 import org.apache.commons.lang.StringUtils;
16
17 import com.google.gson.annotations.SerializedName;
18
19 /**
20  * The {@link UniFiSite} represents the data model of a UniFi site.
21  *
22  * @author Matthew Bowman - Initial contribution
23  */
24 public class UniFiSite {
25
26     private final transient UniFiController controller;
27
28     public UniFiSite(UniFiController controller) {
29         this.controller = controller;
30     }
31
32     @SerializedName("_id")
33     private String id;
34
35     private String name;
36
37     private String desc;
38
39     public String getId() {
40         return id;
41     }
42
43     public String getName() {
44         return name;
45     }
46
47     public String getDescription() {
48         return desc;
49     }
50
51     public boolean matchesName(String siteName) {
52         return StringUtils.equalsIgnoreCase(desc, siteName) || StringUtils.equalsIgnoreCase(name, siteName)
53                 || StringUtils.equalsIgnoreCase(id, siteName);
54     }
55
56     @Override
57     public String toString() {
58         return String.format("UniFiSite{name: '%s', desc: '%s'}", name, desc);
59     }
60 }