1
2
3
4
5
6 package org.apache.maven.model;
7
8
9
10
11
12
13 @SuppressWarnings( "all" )
14 public class Extension
15 implements java.io.Serializable, java.lang.Cloneable, org.apache.maven.model.InputLocationTracker
16 {
17
18
19
20
21
22
23
24
25 private String groupId;
26
27
28
29
30 private String artifactId;
31
32
33
34
35 private String version;
36
37
38
39
40 private java.util.Map<Object, InputLocation> locations;
41
42
43
44
45 private InputLocation location;
46
47
48
49
50 private InputLocation groupIdLocation;
51
52
53
54
55 private InputLocation artifactIdLocation;
56
57
58
59
60 private InputLocation versionLocation;
61
62
63
64
65
66
67
68
69
70
71
72 public Extension clone()
73 {
74 try
75 {
76 Extension copy = (Extension) super.clone();
77
78 if ( copy.locations != null )
79 {
80 copy.locations = new java.util.LinkedHashMap( copy.locations );
81 }
82
83 return copy;
84 }
85 catch ( java.lang.Exception ex )
86 {
87 throw (java.lang.RuntimeException) new java.lang.UnsupportedOperationException( getClass().getName()
88 + " does not support clone()" ).initCause( ex );
89 }
90 }
91
92
93
94
95
96
97 public String getArtifactId()
98 {
99 return this.artifactId;
100 }
101
102
103
104
105
106
107 public String getGroupId()
108 {
109 return this.groupId;
110 }
111
112
113
114
115
116
117
118 public InputLocation getLocation( Object key )
119 {
120 if ( key instanceof String )
121 {
122 switch ( ( String ) key )
123 {
124 case "" :
125 {
126 return this.location;
127 }
128 case "groupId" :
129 {
130 return groupIdLocation;
131 }
132 case "artifactId" :
133 {
134 return artifactIdLocation;
135 }
136 case "version" :
137 {
138 return versionLocation;
139 }
140 default :
141 {
142 return getOtherLocation( key );
143 }
144 }
145 }
146 else
147 {
148 return getOtherLocation( key );
149 }
150 }
151
152
153
154
155
156
157
158 public void setLocation( Object key, InputLocation location )
159 {
160 if ( key instanceof String )
161 {
162 switch ( ( String ) key )
163 {
164 case "" :
165 {
166 this.location = location;
167 return;
168 }
169 case "groupId" :
170 {
171 groupIdLocation = location;
172 return;
173 }
174 case "artifactId" :
175 {
176 artifactIdLocation = location;
177 return;
178 }
179 case "version" :
180 {
181 versionLocation = location;
182 return;
183 }
184 default :
185 {
186 setOtherLocation( key, location );
187 return;
188 }
189 }
190 }
191 else
192 {
193 setOtherLocation( key, location );
194 }
195 }
196
197
198
199
200
201
202
203 public void setOtherLocation( Object key, InputLocation location )
204 {
205 if ( location != null )
206 {
207 if ( this.locations == null )
208 {
209 this.locations = new java.util.LinkedHashMap<Object, InputLocation>();
210 }
211 this.locations.put( key, location );
212 }
213 }
214
215
216
217
218
219
220
221 private InputLocation getOtherLocation( Object key )
222 {
223 return ( locations != null ) ? locations.get( key ) : null;
224 }
225
226
227
228
229
230
231 public String getVersion()
232 {
233 return this.version;
234 }
235
236
237
238
239
240
241 public void setArtifactId( String artifactId )
242 {
243 this.artifactId = artifactId;
244 }
245
246
247
248
249
250
251 public void setGroupId( String groupId )
252 {
253 this.groupId = groupId;
254 }
255
256
257
258
259
260
261 public void setVersion( String version )
262 {
263 this.version = version;
264 }
265
266
267
268
269
270
271 public boolean equals( Object o )
272 {
273 if ( this == o )
274 {
275 return true;
276 }
277
278 if ( !( o instanceof Extension ) )
279 {
280 return false;
281 }
282
283 Extension e = (Extension) o;
284
285 if ( !equal( e.getArtifactId(), getArtifactId() ) )
286 {
287 return false;
288 }
289 else if ( !equal( e.getGroupId(), getGroupId() ) )
290 {
291 return false;
292 }
293 else if ( !equal( e.getVersion(), getVersion() ) )
294 {
295 return false;
296 }
297 return true;
298 }
299
300 private static <T> boolean equal( T obj1, T obj2 )
301 {
302 return ( obj1 != null ) ? obj1.equals( obj2 ) : obj2 == null;
303 }
304
305
306
307
308 public int hashCode()
309 {
310 int result = 17;
311 result = 37 * result + ( getArtifactId() != null ? getArtifactId().hashCode() : 0 );
312 result = 37 * result + ( getGroupId() != null ? getGroupId().hashCode() : 0 );
313 result = 37 * result + ( getVersion() != null ? getVersion().hashCode() : 0 );
314 return result;
315 }
316
317
318 }