1
2
3
4
5 package org.apache.maven.api.model;
6
7 import java.io.Serializable;
8 import java.util.ArrayList;
9 import java.util.Collection;
10 import java.util.Collections;
11 import java.util.HashMap;
12 import java.util.List;
13 import java.util.Map;
14 import org.apache.maven.api.annotations.Experimental;
15 import org.apache.maven.api.annotations.Generated;
16 import org.apache.maven.api.annotations.Immutable;
17 import org.apache.maven.api.annotations.Nonnull;
18 import org.apache.maven.api.annotations.NotThreadSafe;
19 import org.apache.maven.api.annotations.ThreadSafe;
20
21
22
23
24 @Experimental
25 @Generated @ThreadSafe @Immutable
26 public class Developer
27 extends Contributor
28 implements Serializable, InputLocationTracker
29 {
30
31
32
33 final String id;
34
35 final InputLocation idLocation;
36
37
38
39
40
41 Developer(
42 String name,
43 String email,
44 String url,
45 String organization,
46 String organizationUrl,
47 Collection<String> roles,
48 String timezone,
49 Map<String, String> properties,
50 String id,
51 Map<Object, InputLocation> locations,
52 InputLocation location,
53 InputLocation nameLocation,
54 InputLocation emailLocation,
55 InputLocation urlLocation,
56 InputLocation organizationLocation,
57 InputLocation organizationUrlLocation,
58 InputLocation rolesLocation,
59 InputLocation timezoneLocation,
60 InputLocation propertiesLocation,
61 InputLocation idLocation
62 )
63 {
64 super(
65 name,
66 email,
67 url,
68 organization,
69 organizationUrl,
70 roles,
71 timezone,
72 properties,
73 locations,
74 location,
75 nameLocation,
76 emailLocation,
77 urlLocation,
78 organizationLocation,
79 organizationUrlLocation,
80 rolesLocation,
81 timezoneLocation,
82 propertiesLocation
83 );
84 this.id = id;
85 this.idLocation = idLocation;
86 }
87
88
89
90
91
92
93 public String getId()
94 {
95 return this.id;
96 }
97
98
99
100
101 public InputLocation getLocation( Object key )
102 {
103 if ( key instanceof String )
104 {
105 switch ( ( String ) key )
106 {
107 case "id":
108 return idLocation;
109 }
110 }
111 return super.getLocation( key );
112 }
113
114
115
116
117
118
119 @Nonnull
120 public Builder with()
121 {
122 return newBuilder( this );
123 }
124
125
126
127
128
129
130 @Nonnull
131 public Developer withName( String name )
132 {
133 return with().name( name ).build();
134 }
135
136
137
138
139
140
141 @Nonnull
142 public Developer withEmail( String email )
143 {
144 return with().email( email ).build();
145 }
146
147
148
149
150
151
152 @Nonnull
153 public Developer withUrl( String url )
154 {
155 return with().url( url ).build();
156 }
157
158
159
160
161
162
163 @Nonnull
164 public Developer withOrganization( String organization )
165 {
166 return with().organization( organization ).build();
167 }
168
169
170
171
172
173
174 @Nonnull
175 public Developer withOrganizationUrl( String organizationUrl )
176 {
177 return with().organizationUrl( organizationUrl ).build();
178 }
179
180
181
182
183
184
185 @Nonnull
186 public Developer withRoles( Collection<String> roles )
187 {
188 return with().roles( roles ).build();
189 }
190
191
192
193
194
195
196 @Nonnull
197 public Developer withTimezone( String timezone )
198 {
199 return with().timezone( timezone ).build();
200 }
201
202
203
204
205
206
207 @Nonnull
208 public Developer withProperties( Map<String, String> properties )
209 {
210 return with().properties( properties ).build();
211 }
212
213
214
215
216
217
218 @Nonnull
219 public Developer withId( String id )
220 {
221 return with().id( id ).build();
222 }
223
224
225
226
227
228
229
230
231 @Nonnull
232 public static Developer newInstance()
233 {
234 return newInstance( true );
235 }
236
237
238
239
240
241
242
243
244 @Nonnull
245 public static Developer newInstance( boolean withDefaults )
246 {
247 return newBuilder( withDefaults ).build();
248 }
249
250
251
252
253
254
255
256
257 @Nonnull
258 public static Builder newBuilder()
259 {
260 return newBuilder( true );
261 }
262
263
264
265
266
267
268
269 @Nonnull
270 public static Builder newBuilder( boolean withDefaults )
271 {
272 return new Builder( withDefaults );
273 }
274
275
276
277
278
279
280
281
282 @Nonnull
283 public static Builder newBuilder( Developer from )
284 {
285 return newBuilder( from, false );
286 }
287
288
289
290
291
292
293
294
295 @Nonnull
296 public static Builder newBuilder( Developer from, boolean forceCopy )
297 {
298 return new Builder( from, forceCopy );
299 }
300
301
302
303
304
305
306 @NotThreadSafe
307 public static class Builder
308 extends Contributor.Builder
309 {
310 Developer base;
311 String id;
312
313 Builder( boolean withDefaults )
314 {
315 super( withDefaults );
316 if ( withDefaults )
317 {
318 }
319 }
320
321 Builder( Developer base, boolean forceCopy )
322 {
323 super( base, forceCopy );
324 if ( forceCopy )
325 {
326 this.id = base.id;
327 }
328 else
329 {
330 this.base = base;
331 }
332 }
333
334 @Nonnull
335 public Builder name( String name )
336 {
337 this.name = name;
338 return this;
339 }
340
341 @Nonnull
342 public Builder email( String email )
343 {
344 this.email = email;
345 return this;
346 }
347
348 @Nonnull
349 public Builder url( String url )
350 {
351 this.url = url;
352 return this;
353 }
354
355 @Nonnull
356 public Builder organization( String organization )
357 {
358 this.organization = organization;
359 return this;
360 }
361
362 @Nonnull
363 public Builder organizationUrl( String organizationUrl )
364 {
365 this.organizationUrl = organizationUrl;
366 return this;
367 }
368
369 @Nonnull
370 public Builder roles( Collection<String> roles )
371 {
372 this.roles = roles;
373 return this;
374 }
375
376 @Nonnull
377 public Builder timezone( String timezone )
378 {
379 this.timezone = timezone;
380 return this;
381 }
382
383 @Nonnull
384 public Builder properties( Map<String, String> properties )
385 {
386 this.properties = properties;
387 return this;
388 }
389
390 @Nonnull
391 public Builder id( String id )
392 {
393 this.id = id;
394 return this;
395 }
396
397
398 @Nonnull
399 public Builder location( Object key, InputLocation location )
400 {
401 if ( location != null )
402 {
403 if ( this.locations == null )
404 {
405 this.locations = new HashMap<>();
406 }
407 this.locations.put( key, location );
408 }
409 return this;
410 }
411
412 @Nonnull
413 public Developer build()
414 {
415 if ( base != null
416 && ( name == null || name == base.name )
417 && ( email == null || email == base.email )
418 && ( url == null || url == base.url )
419 && ( organization == null || organization == base.organization )
420 && ( organizationUrl == null || organizationUrl == base.organizationUrl )
421 && ( roles == null || roles == base.roles )
422 && ( timezone == null || timezone == base.timezone )
423 && ( properties == null || properties == base.properties )
424 && ( id == null || id == base.id )
425 )
426 {
427 return base;
428 }
429 Map<Object, InputLocation> locations = null;
430 InputLocation location = null;
431 InputLocation nameLocation = null;
432 InputLocation emailLocation = null;
433 InputLocation urlLocation = null;
434 InputLocation organizationLocation = null;
435 InputLocation organizationUrlLocation = null;
436 InputLocation rolesLocation = null;
437 InputLocation timezoneLocation = null;
438 InputLocation propertiesLocation = null;
439 InputLocation idLocation = null;
440 if ( this.locations != null )
441 {
442 locations = this.locations;
443 location = locations.remove( "" );
444 nameLocation = locations.remove( "name" );
445 emailLocation = locations.remove( "email" );
446 urlLocation = locations.remove( "url" );
447 organizationLocation = locations.remove( "organization" );
448 organizationUrlLocation = locations.remove( "organizationUrl" );
449 rolesLocation = locations.remove( "roles" );
450 timezoneLocation = locations.remove( "timezone" );
451 propertiesLocation = locations.remove( "properties" );
452 idLocation = locations.remove( "id" );
453 }
454 return new Developer(
455 name != null ? name : ( base != null ? base.name : null ),
456 email != null ? email : ( base != null ? base.email : null ),
457 url != null ? url : ( base != null ? base.url : null ),
458 organization != null ? organization : ( base != null ? base.organization : null ),
459 organizationUrl != null ? organizationUrl : ( base != null ? base.organizationUrl : null ),
460 roles != null ? roles : ( base != null ? base.roles : null ),
461 timezone != null ? timezone : ( base != null ? base.timezone : null ),
462 properties != null ? properties : ( base != null ? base.properties : null ),
463 id != null ? id : ( base != null ? base.id : null ),
464 locations != null ? locations : ( base != null ? base.locations : null ),
465 location != null ? location : ( base != null ? base.location : null ),
466 nameLocation != null ? nameLocation : ( base != null ? base.nameLocation : null ),
467 emailLocation != null ? emailLocation : ( base != null ? base.emailLocation : null ),
468 urlLocation != null ? urlLocation : ( base != null ? base.urlLocation : null ),
469 organizationLocation != null ? organizationLocation : ( base != null ? base.organizationLocation : null ),
470 organizationUrlLocation != null ? organizationUrlLocation : ( base != null ? base.organizationUrlLocation : null ),
471 rolesLocation != null ? rolesLocation : ( base != null ? base.rolesLocation : null ),
472 timezoneLocation != null ? timezoneLocation : ( base != null ? base.timezoneLocation : null ),
473 propertiesLocation != null ? propertiesLocation : ( base != null ? base.propertiesLocation : null ),
474 idLocation != null ? idLocation : ( base != null ? base.idLocation : null )
475 );
476 }
477 }
478
479
480
481
482
483
484 public String toString()
485 {
486 return "Developer {id=" + getId() + ", " + super.toString() + "}";
487 }
488
489
490 }