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.avmfritz.internal.dto;
15 import javax.xml.bind.annotation.XmlAccessType;
16 import javax.xml.bind.annotation.XmlAccessorType;
17 import javax.xml.bind.annotation.XmlAttribute;
18 import javax.xml.bind.annotation.XmlElement;
19 import javax.xml.bind.annotation.XmlRootElement;
22 * See {@link DeviceListModel}.
24 * @author Christoph Weitkamp - Initial contribution
26 @XmlAccessorType(XmlAccessType.FIELD)
27 @XmlRootElement(name = "button")
28 public class ButtonModel {
30 @XmlAttribute(name = "identifier")
31 private String identifier;
33 @XmlAttribute(name = "id")
34 private String buttonId;
36 @XmlElement(name = "name")
39 @XmlElement(name = "lastpressedtimestamp")
40 private int lastpressedtimestamp;
42 public String getName() {
46 public void setName(String name) {
50 public String getIdentifier() {
51 return identifier != null ? identifier.replace(" ", "") : null;
54 public void setIdentifier(String identifier) {
55 this.identifier = identifier;
58 public String getButtonId() {
62 public void setButtonId(String buttonId) {
63 this.buttonId = buttonId;
66 public int getLastpressedtimestamp() {
67 return lastpressedtimestamp;
70 public void setLastpressedtimestamp(int lastpressedtimestamp) {
71 this.lastpressedtimestamp = lastpressedtimestamp;
75 public int hashCode() {
78 result = prime * result + (identifier != null ? identifier.hashCode() : 0);
79 result = prime * result + (buttonId != null ? buttonId.hashCode() : 0);
80 result = prime * result + (name != null ? name.hashCode() : 0);
85 public boolean equals(Object obj) {
92 if (getClass() != obj.getClass()) {
95 ButtonModel other = (ButtonModel) obj;
96 return (identifier != null ? identifier.equals(other.identifier) : other.identifier == null) && //
97 (buttonId != null ? buttonId.equals(other.buttonId) : other.buttonId == null) && //
98 (name != null ? name.equals(other.name) : other.name == null);
102 public String toString() {
103 return new StringBuilder().append("[identifier=").append(getIdentifier()).append(",id=").append(buttonId)
104 .append(",name=").append(name).append(",lastpressedtimestamp=").append(lastpressedtimestamp).append("]")