2 * Copyright (c) 2010-2020 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.gardena.internal.model;
15 import java.util.Date;
16 import java.util.List;
18 import org.openhab.binding.gardena.internal.GardenaSmartCommandName;
20 import com.google.gson.annotations.SerializedName;
23 * Represents a Gardena property.
25 * @author Gerhard Riegler - Initial contribution
27 public class Property {
30 private PropertyValue value;
31 private Date timestamp;
33 private boolean writeable;
35 @SerializedName("supported_values")
36 private List<String> supportedValues;
37 private transient Ability ability;
42 public Property(GardenaSmartCommandName commandName, String value) {
43 this.name = commandName.toString().toLowerCase();
44 this.value = new PropertyValue(value);
48 * Returns the name of the property.
50 public String getName() {
55 * Returns the value of the property.
57 public String getValueAsString() {
58 return value != null ? value.getValue() : null;
62 * Returns the value of the property.
64 public PropertyValue getValue() {
69 * Sets the value of the property.
71 public void setValue(PropertyValue value) {
76 * Returns the timestamp of the property.
78 public Date getTimestamp() {
83 * Returns the unit of the property.
85 public String getUnit() {
90 * Returns true, if the property is writeable.
92 public boolean isWriteable() {
97 * Returns a list of supported values.
99 public List<String> getSupportedValues() {
100 return supportedValues;
104 * Returns the ability of the property.
107 public Ability getAbility() {
112 * Sets the ability of the property.
114 public void setAbility(Ability ability) {
115 this.ability = ability;