2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
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
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.lametrictime.internal.api.local.dto;
18 * @author Gregory Moyer - Initial contribution
20 public class Bluetooth {
21 private Boolean active;
24 * API sometimes calls this field 'mac' and other times calls it 'address'.
25 * Additionally, Gson uses fields only (not methods). Therefore, if use the
26 * same instance of this class to read one value and then try to write the
27 * other without calling the setter, it won't work (the other value will be
31 private String address;
33 private Boolean available;
34 private Boolean discoverable;
36 private Boolean pairable;
38 public Boolean isActive() {
42 public void setActive(Boolean active) {
46 public Bluetooth withActive(Boolean active) {
51 public String getMac() {
52 return mac == null ? address : mac;
55 public void setMac(String mac) {
60 public Bluetooth withMac(String mac) {
65 public Boolean isAvailable() {
69 public void setAvailable(Boolean available) {
70 this.available = available;
73 public Bluetooth withAvailable(Boolean available) {
74 this.available = available;
78 public Boolean isDiscoverable() {
82 public void setDiscoverable(Boolean discoverable) {
83 this.discoverable = discoverable;
86 public Bluetooth withDiscoverable(Boolean discoverable) {
87 this.discoverable = discoverable;
91 public String getName() {
95 public void setName(String name) {
99 public Bluetooth withName(String name) {
104 public Boolean isPairable() {
108 public void setPairable(Boolean pairable) {
109 this.pairable = pairable;
112 public Bluetooth withPairable(Boolean pairable) {
113 this.pairable = pairable;
118 public String toString() {
119 StringBuilder builder = new StringBuilder();
120 builder.append("Bluetooth [active=");
121 builder.append(active);
122 builder.append(", mac=");
123 builder.append(getMac());
124 builder.append(", available=");
125 builder.append(available);
126 builder.append(", discoverable=");
127 builder.append(discoverable);
128 builder.append(", name=");
129 builder.append(name);
130 builder.append(", pairable=");
131 builder.append(pairable);
133 return builder.toString();