]> git.basschouten.com Git - openhab-addons.git/blob
0fec738bbc2174903f0ae4de9d8a8c3f14c97790
[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.unifi.internal;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.binding.unifi.internal.handler.UniFiControllerThingHandler;
17
18 /**
19  * The {@link UniFiControllerThingConfig} encapsulates all the configuration options for an instance of the
20  * {@link UniFiControllerThingHandler}.
21  *
22  * @author Matthew Bowman - Initial contribution
23  */
24 @NonNullByDefault
25 @SuppressWarnings("unused")
26 public class UniFiControllerThingConfig {
27
28     private String host = "unifi";
29
30     private int port = 8443;
31
32     private String username = "";
33
34     private String password = "";
35
36     private int refresh = 10;
37
38     private boolean unifios = false;
39
40     public String getHost() {
41         return host;
42     }
43
44     private void setHost(final String host) {
45         // method to avoid ide auto format mark the field as final
46         this.host = host;
47     }
48
49     public int getPort() {
50         return port;
51     }
52
53     private void setPort(final int port) {
54         // method to avoid ide auto format mark the field as final
55         this.port = port;
56     }
57
58     public String getUsername() {
59         return username;
60     }
61
62     private void setUsername(final String username) {
63         // method to avoid ide auto format mark the field as final
64         this.username = username;
65     }
66
67     public String getPassword() {
68         return password;
69     }
70
71     private void setPassword(final String password) {
72         // method to avoid ide auto format mark the field as final
73         this.password = password;
74     }
75
76     public int getRefresh() {
77         return refresh;
78     }
79
80     private void setRefresh(final int refresh) {
81         // method to avoid ide auto format mark the field as final
82         this.refresh = refresh;
83     }
84
85     public boolean isUniFiOS() {
86         return unifios;
87     }
88
89     private void setUnifiOS(final boolean unifios) {
90         // method to avoid ide auto format mark the field as final
91         this.unifios = unifios;
92     }
93
94     public boolean isValid() {
95         return !host.isBlank() && !username.isBlank() && !password.isBlank();
96     }
97
98     @Override
99     public String toString() {
100         return "UniFiControllerConfig{host = " + host + ", port = " + port + ", username = " + username
101                 + ", password = *****, refresh = " + refresh + ", unifios = " + unifios + "}";
102     }
103 }