]> git.basschouten.com Git - openhab-addons.git/blob
c4e67d7fe37432b2bf7a90f7beb3dc429ffa810e
[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.paradoxalarm.internal.model;
14
15 import java.util.Date;
16
17 import org.slf4j.Logger;
18 import org.slf4j.LoggerFactory;
19
20 /**
21  * The {@link Version} This class holds version information
22  *
23  * @author Konstantin Polihronov - Initial contribution
24  */
25 public class Version {
26     private final Logger logger = LoggerFactory.getLogger(Version.class);
27
28     private Byte version;
29     private Byte revision;
30     private Byte build;
31     private Date buildTime;
32
33     public Version(Byte version, Byte revision) {
34         this(version, revision, null);
35     }
36
37     public Version(Byte version, Byte revision, Byte build) {
38         this(version, revision, build, null);
39     }
40
41     public Version(Byte version, Byte revision, Byte build, Date buildTime) {
42         this.version = version;
43         this.revision = revision;
44         this.build = build;
45         this.buildTime = buildTime;
46         logger.debug("version={}", this);
47     }
48
49     public Byte getVersion() {
50         return version;
51     }
52
53     public void setVersion(Byte version) {
54         this.version = version;
55     }
56
57     public Byte getRevision() {
58         return revision;
59     }
60
61     public void setRevision(Byte revision) {
62         this.revision = revision;
63     }
64
65     public Byte getBuild() {
66         return build;
67     }
68
69     public void setBuild(Byte build) {
70         this.build = build;
71     }
72
73     public Date getBuildTime() {
74         return buildTime;
75     }
76
77     public void setBuildTime(Date buildTime) {
78         this.buildTime = buildTime;
79     }
80
81     @Override
82     public String toString() {
83         StringBuilder sb = new StringBuilder();
84         sb.append("Version: ");
85         sb.append(version);
86         sb.append(".");
87         sb.append(revision);
88         if (build != null) {
89             sb.append(".");
90             sb.append(build);
91         }
92         if (buildTime != null) {
93             sb.append("/");
94             sb.append(buildTime);
95         }
96         return sb.toString();
97     }
98 }