]> git.basschouten.com Git - openhab-addons.git/blob
47da66981ff68f5d9c5bff70772cc014b5e49953
[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.mqtt.homeassistant.internal.config.dto;
14
15 import java.util.List;
16
17 import org.eclipse.jdt.annotation.Nullable;
18 import org.openhab.binding.mqtt.homeassistant.internal.config.ListOrStringDeserializer;
19
20 import com.google.gson.annotations.JsonAdapter;
21 import com.google.gson.annotations.SerializedName;
22
23 /**
24  * Device configuration
25  *
26  * @author Jochen Klein - Initial contribution
27  */
28 public class Device {
29     @JsonAdapter(ListOrStringDeserializer.class)
30     protected @Nullable List<String> identifiers;
31     protected @Nullable List<Connection> connections;
32     protected @Nullable String manufacturer;
33     protected @Nullable String model;
34     protected @Nullable String name;
35
36     @SerializedName("sw_version")
37     protected @Nullable String swVersion;
38
39     public @Nullable String getId() {
40         List<String> identifiers = this.identifiers;
41         return identifiers == null ? null : String.join("_", identifiers);
42     }
43
44     @Nullable
45     public List<Connection> getConnections() {
46         return connections;
47     }
48
49     @Nullable
50     public String getManufacturer() {
51         return manufacturer;
52     }
53
54     @Nullable
55     public String getModel() {
56         return model;
57     }
58
59     @Nullable
60     public String getName() {
61         return name;
62     }
63
64     @Nullable
65     public String getSwVersion() {
66         return swVersion;
67     }
68
69     @Nullable
70     public List<String> getIdentifiers() {
71         return identifiers;
72     }
73 }