1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package com.atlassian.jira.rest.client.api.domain;
18
19 import com.google.common.base.Objects;
20 import org.joda.time.DateTime;
21
22 import javax.annotation.Nullable;
23 import java.net.URI;
24
25
26
27
28
29
30 public class ServerInfo {
31 private final URI baseUri;
32 private final String version;
33 private final int buildNumber;
34 private final DateTime buildDate;
35 @Nullable
36 private final DateTime serverTime;
37 private final String scmInfo;
38 private final String serverTitle;
39
40 public ServerInfo(URI baseUri, String version, int buildNumber, DateTime buildDate, @Nullable DateTime serverTime,
41 String scmInfo, String serverTitle) {
42 this.baseUri = baseUri;
43 this.version = version;
44 this.buildNumber = buildNumber;
45 this.buildDate = buildDate;
46 this.serverTime = serverTime;
47 this.scmInfo = scmInfo;
48 this.serverTitle = serverTitle;
49 }
50
51
52
53
54 public URI getBaseUri() {
55 return baseUri;
56 }
57
58
59
60
61 public String getVersion() {
62 return version;
63 }
64
65
66
67
68 public int getBuildNumber() {
69 return buildNumber;
70 }
71
72
73
74
75 public DateTime getBuildDate() {
76 return buildDate;
77 }
78
79
80
81
82
83 @Nullable
84 public DateTime getServerTime() {
85 return serverTime;
86 }
87
88
89
90
91 public String getScmInfo() {
92 return scmInfo;
93 }
94
95
96
97
98 public String getServerTitle() {
99 return serverTitle;
100 }
101
102 @Override
103 public String toString() {
104 return Objects.toStringHelper(this).addValue(super.toString()).
105 add("baseUri", baseUri).
106 add("version", version).
107 add("buildNumber", buildNumber).
108 add("buildDate", buildDate).
109 add("serverTime", serverTime).
110 add("svnRevision", scmInfo).
111 add("serverTitle", serverTitle).
112 toString();
113 }
114
115
116 @Override
117 public boolean equals(Object obj) {
118 if (obj instanceof ServerInfo) {
119 ServerInfo that = (ServerInfo) obj;
120 return Objects.equal(this.baseUri, that.baseUri)
121 && Objects.equal(this.version, that.version)
122 && Objects.equal(this.buildNumber, that.buildNumber)
123 && Objects.equal(this.buildDate, that.buildDate)
124 && Objects.equal(this.serverTime, that.serverTime)
125 && Objects.equal(this.scmInfo, that.scmInfo)
126 && Objects.equal(this.serverTitle, that.serverTitle);
127 }
128 return false;
129 }
130
131 @Override
132 public int hashCode() {
133 return Objects.hashCode(baseUri, version, buildNumber, buildDate, serverTime, scmInfo, serverTitle);
134 }
135
136 }