]> git.basschouten.com Git - openhab-addons.git/blob
5e60320c5e4a3ad0d13811e2bc446ca081a0c7f3
[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.avmfritz.internal.dto;
14
15 import java.math.BigDecimal;
16
17 import javax.xml.bind.annotation.XmlAccessType;
18 import javax.xml.bind.annotation.XmlAccessorType;
19 import javax.xml.bind.annotation.XmlElement;
20 import javax.xml.bind.annotation.XmlRootElement;
21
22 /**
23  * See {@link DeviceListModel}.
24  *
25  * @author Ulrich Mertin - Initial contribution
26  */
27 @XmlAccessorType(XmlAccessType.FIELD)
28 @XmlRootElement(name = "levelcontrol")
29 public class LevelControlModel {
30
31     @XmlElement(name = "level")
32     private BigDecimal level;
33
34     @XmlElement(name = "levelpercentage")
35     private BigDecimal levelPercentage;
36
37     public BigDecimal getLevel() {
38         return level != null ? level : BigDecimal.ZERO;
39     }
40
41     public void setLevel(BigDecimal level) {
42         this.level = level;
43     }
44
45     public BigDecimal getLevelPercentage() {
46         return levelPercentage != null ? levelPercentage : BigDecimal.ZERO;
47     }
48
49     public void setLevelPercentage(BigDecimal levelPercentage) {
50         this.levelPercentage = levelPercentage;
51     }
52
53     @Override
54     public String toString() {
55         return new StringBuilder("[level=").append(getLevel()).append(",levelpercentage=").append(getLevelPercentage())
56                 .append("]").toString();
57     }
58 }