]> git.basschouten.com Git - openhab-addons.git/blob
ffb7f6a54a4fd82ced8c6378238ff45cec410b4f
[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.dbquery.internal.config;
14
15 import java.util.StringJoiner;
16
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18
19 /**
20  * Contains fields mapping InfluxDB2 bridge configuration parameters.
21  *
22  * @author Joan Pujol - Initial contribution
23  */
24 @NonNullByDefault
25 public class InfluxDB2BridgeConfiguration {
26     private String url;
27     private String user;
28     private String token;
29     private String bucket;
30     private String organization;
31
32     public InfluxDB2BridgeConfiguration(String url, String user, String token, String organization, String bucket) {
33         this.url = url;
34         this.user = user;
35         this.token = token;
36         this.organization = organization;
37         this.bucket = bucket;
38     }
39
40     public InfluxDB2BridgeConfiguration() {
41         // Used only when configuration is created by reflection using ConfigMapper
42         url = user = token = organization = bucket = "";
43     }
44
45     public String getUrl() {
46         return url;
47     }
48
49     public String getUser() {
50         return user;
51     }
52
53     public String getToken() {
54         return token;
55     }
56
57     public String getOrganization() {
58         return organization;
59     }
60
61     public String getBucket() {
62         return bucket;
63     }
64
65     @Override
66     public String toString() {
67         return new StringJoiner(", ", InfluxDB2BridgeConfiguration.class.getSimpleName() + "[", "]")
68                 .add("url='" + url + "'").add("user='" + user + "'").add("token='" + "*".repeat(token.length()) + "'")
69                 .add("organization='" + organization + "'").add("bucket='" + bucket + "'").toString();
70     }
71 }