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.ArrayList;
16 import java.util.List;
18 import org.openhab.binding.gardena.internal.exception.GardenaException;
21 * Represents a Gardena ability.
23 * @author Gerhard Riegler - Initial contribution
25 public class Ability {
29 private transient Device device;
31 private List<Property> properties = new ArrayList<>();
34 * Returns the name of the ability.
36 public String getName() {
41 * Returns the type of the ability.
43 public String getType() {
48 * Returns a list of properties of the ability.
50 public List<Property> getProperties() {
55 * Adds a property to this ability.
57 public void addProperty(Property property) {
58 property.setAbility(this);
59 properties.add(property);
63 * Returns the property with the specified name.
65 public Property getProperty(String name) throws GardenaException {
66 for (Property property : properties) {
67 if (property.getName().equals(name)) {
71 throw new GardenaException("Property '" + name + "' not found in ability '" + this.name + "'");
75 * Returns the device of the ability.
77 public Device getDevice() {
82 * Sets the name of the ability.
84 public void setDevice(Device device) {