]> git.basschouten.com Git - openhab-addons.git/blob
ee37c428647ed42aba987cd2d7e7e09668d972cd
[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.unifi.internal;
14
15 import org.apache.commons.lang.StringUtils;
16 import org.openhab.binding.unifi.internal.handler.UniFiClientThingHandler;
17
18 /**
19  * The {@link UniFiClientThingConfig} encapsulates all the configuration options for an instance of the
20  * {@link UniFiClientThingHandler}.
21  *
22  * @author Matthew Bowman - Initial contribution
23  */
24 public class UniFiClientThingConfig {
25
26     private String cid = "";
27
28     private String site = "";
29
30     private int considerHome = 180;
31
32     public String getClientID() {
33         return cid;
34     }
35
36     public String getSite() {
37         return site;
38     }
39
40     public int getConsiderHome() {
41         return considerHome;
42     }
43
44     public UniFiClientThingConfig tidy() {
45         cid = StringUtils.lowerCase(StringUtils.strip(cid));
46         site = StringUtils.lowerCase(StringUtils.strip(site));
47         return this;
48     }
49
50     public boolean isValid() {
51         return StringUtils.isNotBlank(cid);
52     }
53
54     @Override
55     public String toString() {
56         return String.format("UniFiClientConfig{cid: '%s', site: '%s', considerHome: %d}", cid, site, considerHome);
57     }
58 }