1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package com.atlassian.jira.rest.client.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
62 public String getVersion() {
63 return version;
64 }
65
66
67
68
69 public int getBuildNumber() {
70 return buildNumber;
71 }
72
73
74
75
76 public DateTime getBuildDate() {
77 return buildDate;
78 }
79
80
81
82
83
84 @Nullable
85 public DateTime getServerTime() {
86 return serverTime;
87 }
88
89
90
91
92 public String getScmInfo() {
93 return scmInfo;
94 }
95
96
97
98
99 public String getServerTitle() {
100 return serverTitle;
101 }
102
103 @Override
104 public String toString() {
105 return Objects.toStringHelper(this).addValue(super.toString()).
106 add("baseUri", baseUri).
107 add("version", version).
108 add("buildNumber", buildNumber).
109 add("buildDate", buildDate).
110 add("serverTime", serverTime).
111 add("svnRevision", scmInfo).
112 add("serverTitle", serverTitle).
113 toString();
114 }
115
116
117 @Override
118 public boolean equals(Object obj) {
119 if (obj instanceof ServerInfo) {
120 ServerInfo that = (ServerInfo) obj;
121 return Objects.equal(this.baseUri, that.baseUri)
122 && Objects.equal(this.version, that.version)
123 && Objects.equal(this.buildNumber, that.buildNumber)
124 && Objects.equal(this.buildDate, that.buildDate)
125 && Objects.equal(this.serverTime, that.serverTime)
126 && Objects.equal(this.scmInfo, that.scmInfo)
127 && Objects.equal(this.serverTitle, that.serverTitle);
128 }
129 return false;
130 }
131
132 @Override
133 public int hashCode() {
134 return Objects.hashCode(baseUri, version, buildNumber, buildDate, serverTime, scmInfo, serverTitle);
135 }
136
137 }