1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.jclouds.compute.domain;
20
21 import static com.google.common.base.Preconditions.checkNotNull;
22
23 import javax.annotation.Nullable;
24
25 import com.google.common.annotations.Beta;
26
27
28
29
30
31
32 @Beta
33 public class OperatingSystem {
34 @Nullable
35 private OsFamily family;
36 @Nullable
37 private String name;
38 @Nullable
39 private String arch;
40 @Nullable
41 private String version;
42 private String description;
43 private boolean is64Bit;
44
45
46 protected OperatingSystem() {
47
48 }
49
50 public OperatingSystem(@Nullable OsFamily family, @Nullable String name, @Nullable String version,
51 @Nullable String arch, String description, boolean is64Bit) {
52 this.family = family;
53 this.name = name;
54 this.arch = arch;
55 this.version = version;
56 this.description = checkNotNull(description, "description");
57 this.is64Bit = is64Bit;
58 }
59
60
61
62
63
64
65
66
67 @Nullable
68 public OsFamily getFamily() {
69 return family;
70 }
71
72
73
74
75
76
77
78
79
80
81
82 @Nullable
83 public String getName() {
84 return name;
85 }
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102 @Nullable
103 public String getArch() {
104 return arch;
105 }
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121 @Nullable
122 public String getVersion() {
123 return version;
124 }
125
126
127
128
129
130
131
132
133
134
135
136 public String getDescription() {
137 return description;
138 }
139
140
141
142
143
144 public boolean is64Bit() {
145 return is64Bit;
146 }
147
148 @Override
149 public int hashCode() {
150 final int prime = 31;
151 int result = 1;
152 result = prime * result + ((arch == null) ? 0 : arch.hashCode());
153 result = prime * result + ((description == null) ? 0 : description.hashCode());
154 result = prime * result + ((family == null) ? 0 : family.hashCode());
155 result = prime * result + (is64Bit ? 1231 : 1237);
156 result = prime * result + ((name == null) ? 0 : name.hashCode());
157 result = prime * result + ((version == null) ? 0 : version.hashCode());
158 return result;
159 }
160
161 @Override
162 public boolean equals(Object obj) {
163 if (this == obj)
164 return true;
165 if (obj == null)
166 return false;
167 if (getClass() != obj.getClass())
168 return false;
169 OperatingSystem other = (OperatingSystem) obj;
170 if (arch == null) {
171 if (other.arch != null)
172 return false;
173 } else if (!arch.equals(other.arch))
174 return false;
175 if (description == null) {
176 if (other.description != null)
177 return false;
178 } else if (!description.equals(other.description))
179 return false;
180 if (family == null) {
181 if (other.family != null)
182 return false;
183 } else if (!family.equals(other.family))
184 return false;
185 if (is64Bit != other.is64Bit)
186 return false;
187 if (name == null) {
188 if (other.name != null)
189 return false;
190 } else if (!name.equals(other.name))
191 return false;
192 if (version == null) {
193 if (other.version != null)
194 return false;
195 } else if (!version.equals(other.version))
196 return false;
197 return true;
198 }
199
200 @Override
201 public String toString() {
202 return "[name=" + name + ", family=" + family + ", version=" + version + ", arch=" + arch + ", is64Bit="
203 + is64Bit + ", description=" + description + "]";
204 }
205
206 }