]> git.basschouten.com Git - openhab-addons.git/blob
0de0b6eee44c8fd2af5e9377cc7725f26ff3f73f
[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.nest.internal.wwn.dto;
14
15 import java.util.HashMap;
16 import java.util.Map;
17
18 /**
19  * Contains the data needed to do a WWN update request back to Nest.
20  *
21  * @author David Bennett - Initial contribution
22  */
23 public class WWNUpdateRequest {
24     private final String updatePath;
25     private final Map<String, Object> values;
26
27     private WWNUpdateRequest(Builder builder) {
28         this.updatePath = builder.basePath + builder.identifier;
29         this.values = builder.values;
30     }
31
32     public String getUpdatePath() {
33         return updatePath;
34     }
35
36     public Map<String, Object> getValues() {
37         return values;
38     }
39
40     public static class Builder {
41         private String basePath;
42         private String identifier;
43         private Map<String, Object> values = new HashMap<>();
44
45         public Builder withBasePath(String basePath) {
46             this.basePath = basePath;
47             return this;
48         }
49
50         public Builder withIdentifier(String identifier) {
51             this.identifier = identifier;
52             return this;
53         }
54
55         public Builder withAdditionalValue(String field, Object value) {
56             values.put(field, value);
57             return this;
58         }
59
60         public WWNUpdateRequest build() {
61             return new WWNUpdateRequest(this);
62         }
63     }
64 }