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