This project has retired. For details please refer to its
Attic page.
ArtifactReference xref
1 package org.apache.archiva.model;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 @SuppressWarnings( "all" )
28 public class ArtifactReference
29 implements java.io.Serializable
30 {
31
32
33
34
35
36
37
38
39
40
41 private String groupId;
42
43
44
45
46
47
48 private String artifactId;
49
50
51
52
53
54
55 private String version;
56
57
58
59
60
61
62 private String classifier;
63
64
65
66
67
68
69 private String type;
70
71
72
73
74
75
76
77
78
79
80
81 public String getArtifactId()
82 {
83 return this.artifactId;
84 }
85
86
87
88
89
90
91 public String getClassifier()
92 {
93 return this.classifier;
94 }
95
96
97
98
99
100
101 public String getGroupId()
102 {
103 return this.groupId;
104 }
105
106
107
108
109
110
111 public String getType()
112 {
113 return this.type;
114 }
115
116
117
118
119
120
121 public String getVersion()
122 {
123 return this.version;
124 }
125
126
127
128
129
130
131 public void setArtifactId( String artifactId )
132 {
133 this.artifactId = artifactId;
134 }
135
136
137
138
139
140
141 public void setClassifier( String classifier )
142 {
143 this.classifier = classifier;
144 }
145
146
147
148
149
150
151 public void setGroupId( String groupId )
152 {
153 this.groupId = groupId;
154 }
155
156
157
158
159
160
161 public void setType( String type )
162 {
163 this.type = type;
164 }
165
166
167
168
169
170
171 public void setVersion( String version )
172 {
173 this.version = version;
174 }
175
176
177 private static final long serialVersionUID = -6116764846682178732L;
178
179
180 private static String defaultString( String value )
181 {
182 if ( value == null )
183 {
184 return "";
185 }
186
187 return value.trim();
188 }
189
190 public static String toKey( ArtifactReference artifactReference )
191 {
192 StringBuilder key = new StringBuilder();
193
194 key.append( defaultString( artifactReference.getGroupId() ) ).append( ":" );
195 key.append( defaultString( artifactReference.getArtifactId() ) ).append( ":" );
196 key.append( defaultString( artifactReference.getVersion() ) ).append( ":" );
197 key.append( defaultString( artifactReference.getClassifier() ) ).append( ":" );
198 key.append( defaultString( artifactReference.getType() ) );
199
200 return key.toString();
201 }
202
203 public static String toVersionlessKey( ArtifactReference artifactReference )
204 {
205 StringBuilder key = new StringBuilder();
206
207 key.append( defaultString( artifactReference.getGroupId() ) ).append( ":" );
208 key.append( defaultString( artifactReference.getArtifactId() ) ).append( ":" );
209 key.append( defaultString( artifactReference.getClassifier() ) ).append( ":" );
210 key.append( defaultString( artifactReference.getType() ) );
211
212 return key.toString();
213 }
214
215
216 public int hashCode()
217 {
218 final int PRIME = 31;
219 int result = 1;
220 result = PRIME * result + ( ( groupId == null ) ? 0 : groupId.hashCode() );
221 result = PRIME * result + ( ( artifactId == null ) ? 0 : artifactId.hashCode() );
222 result = PRIME * result + ( ( version == null ) ? 0 : version.hashCode() );
223 result = PRIME * result + ( ( classifier == null ) ? 0 : classifier.hashCode() );
224 result = PRIME * result + ( ( type == null ) ? 0 : type.hashCode() );
225 return result;
226 }
227
228 public boolean equals( Object obj )
229 {
230 if ( this == obj )
231 {
232 return true;
233 }
234
235 if ( obj == null )
236 {
237 return false;
238 }
239
240 if ( getClass() != obj.getClass() )
241 {
242 return false;
243 }
244
245 final ArtifactReference./org/apache/archiva/model/ArtifactReference.html#ArtifactReference">ArtifactReference other = (ArtifactReference) obj;
246
247 if ( groupId == null )
248 {
249 if ( other.groupId != null )
250 {
251 return false;
252 }
253 }
254 else if ( !groupId.equals( other.groupId ) )
255 {
256 return false;
257 }
258
259 if ( artifactId == null )
260 {
261 if ( other.artifactId != null )
262 {
263 return false;
264 }
265 }
266 else if ( !artifactId.equals( other.artifactId ) )
267 {
268 return false;
269 }
270
271 if ( version == null )
272 {
273 if ( other.version != null )
274 {
275 return false;
276 }
277 }
278 else if ( !version.equals( other.version ) )
279 {
280 return false;
281 }
282
283 if ( classifier == null )
284 {
285 if ( other.classifier != null )
286 {
287 return false;
288 }
289 }
290 else if ( !classifier.equals( other.classifier ) )
291 {
292 return false;
293 }
294
295 if ( type == null )
296 {
297 if ( other.type != null )
298 {
299 return false;
300 }
301 }
302 else if ( !type.equals( other.type ) )
303 {
304 return false;
305 }
306
307 return true;
308 }
309
310 }