1
2
3
4
5
6 package org.apache.maven.model;
7
8
9
10
11
12
13
14
15
16
17
18 @SuppressWarnings( "all" )
19 public class ModelBase
20 implements java.io.Serializable, java.lang.Cloneable, org.apache.maven.model.InputLocationTracker
21 {
22
23
24
25
26
27
28
29
30 private java.util.List<String> modules;
31
32
33
34
35
36
37
38 private DistributionManagement distributionManagement;
39
40
41
42
43 private java.util.Properties properties;
44
45
46
47
48
49
50
51
52
53
54
55
56 private DependencyManagement dependencyManagement;
57
58
59
60
61 private java.util.List<Dependency> dependencies;
62
63
64
65
66 private java.util.List<Repository> repositories;
67
68
69
70
71 private java.util.List<Repository> pluginRepositories;
72
73
74
75
76
77
78
79
80 private Object reports;
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96 private Reporting reporting;
97
98
99
100
101 private java.util.Map<Object, InputLocation> locations;
102
103
104
105
106 private InputLocation location;
107
108
109
110
111 private InputLocation modulesLocation;
112
113
114
115
116 private InputLocation distributionManagementLocation;
117
118
119
120
121 private InputLocation propertiesLocation;
122
123
124
125
126 private InputLocation dependencyManagementLocation;
127
128
129
130
131 private InputLocation dependenciesLocation;
132
133
134
135
136 private InputLocation repositoriesLocation;
137
138
139
140
141 private InputLocation pluginRepositoriesLocation;
142
143
144
145
146 private InputLocation reportsLocation;
147
148
149
150
151 private InputLocation reportingLocation;
152
153
154
155
156
157
158
159
160
161
162
163 public void addDependency( Dependency dependency )
164 {
165 getDependencies().add( dependency );
166 }
167
168
169
170
171
172
173 public void addModule( String string )
174 {
175 getModules().add( string );
176 }
177
178
179
180
181
182
183 public void addPluginRepository( Repository repository )
184 {
185 getPluginRepositories().add( repository );
186 }
187
188
189
190
191
192
193
194 public void addProperty( String key, String value )
195 {
196 getProperties().put( key, value );
197 }
198
199
200
201
202
203
204 public void addRepository( Repository repository )
205 {
206 getRepositories().add( repository );
207 }
208
209
210
211
212
213
214 public ModelBase clone()
215 {
216 try
217 {
218 ModelBase copy = (ModelBase) super.clone();
219
220 if ( this.modules != null )
221 {
222 copy.modules = new java.util.ArrayList<String>();
223 copy.modules.addAll( this.modules );
224 }
225
226 if ( this.distributionManagement != null )
227 {
228 copy.distributionManagement = (DistributionManagement) this.distributionManagement.clone();
229 }
230
231 if ( this.properties != null )
232 {
233 copy.properties = (java.util.Properties) this.properties.clone();
234 }
235
236 if ( this.dependencyManagement != null )
237 {
238 copy.dependencyManagement = (DependencyManagement) this.dependencyManagement.clone();
239 }
240
241 if ( this.dependencies != null )
242 {
243 copy.dependencies = new java.util.ArrayList<Dependency>();
244 for ( Dependency item : this.dependencies )
245 {
246 copy.dependencies.add( ( (Dependency) item).clone() );
247 }
248 }
249
250 if ( this.repositories != null )
251 {
252 copy.repositories = new java.util.ArrayList<Repository>();
253 for ( Repository item : this.repositories )
254 {
255 copy.repositories.add( ( (Repository) item).clone() );
256 }
257 }
258
259 if ( this.pluginRepositories != null )
260 {
261 copy.pluginRepositories = new java.util.ArrayList<Repository>();
262 for ( Repository item : this.pluginRepositories )
263 {
264 copy.pluginRepositories.add( ( (Repository) item).clone() );
265 }
266 }
267
268 if ( this.reports != null )
269 {
270 copy.reports = new org.codehaus.plexus.util.xml.Xpp3Dom( (org.codehaus.plexus.util.xml.Xpp3Dom) this.reports );
271 }
272
273 if ( this.reporting != null )
274 {
275 copy.reporting = (Reporting) this.reporting.clone();
276 }
277
278 if ( copy.locations != null )
279 {
280 copy.locations = new java.util.LinkedHashMap( copy.locations );
281 }
282
283 return copy;
284 }
285 catch ( java.lang.Exception ex )
286 {
287 throw (java.lang.RuntimeException) new java.lang.UnsupportedOperationException( getClass().getName()
288 + " does not support clone()" ).initCause( ex );
289 }
290 }
291
292
293
294
295
296
297 public java.util.List<Dependency> getDependencies()
298 {
299 if ( this.dependencies == null )
300 {
301 this.dependencies = new java.util.ArrayList<Dependency>();
302 }
303
304 return this.dependencies;
305 }
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320 public DependencyManagement getDependencyManagement()
321 {
322 return this.dependencyManagement;
323 }
324
325
326
327
328
329
330
331
332
333 public DistributionManagement getDistributionManagement()
334 {
335 return this.distributionManagement;
336 }
337
338
339
340
341
342
343
344 public InputLocation getLocation( Object key )
345 {
346 if ( key instanceof String )
347 {
348 switch ( ( String ) key )
349 {
350 case "" :
351 {
352 return this.location;
353 }
354 case "modules" :
355 {
356 return modulesLocation;
357 }
358 case "distributionManagement" :
359 {
360 return distributionManagementLocation;
361 }
362 case "properties" :
363 {
364 return propertiesLocation;
365 }
366 case "dependencyManagement" :
367 {
368 return dependencyManagementLocation;
369 }
370 case "dependencies" :
371 {
372 return dependenciesLocation;
373 }
374 case "repositories" :
375 {
376 return repositoriesLocation;
377 }
378 case "pluginRepositories" :
379 {
380 return pluginRepositoriesLocation;
381 }
382 case "reports" :
383 {
384 return reportsLocation;
385 }
386 case "reporting" :
387 {
388 return reportingLocation;
389 }
390 default :
391 {
392 return getOtherLocation( key );
393 }
394 }
395 }
396 else
397 {
398 return getOtherLocation( key );
399 }
400 }
401
402
403
404
405
406
407 public java.util.List<String> getModules()
408 {
409 if ( this.modules == null )
410 {
411 this.modules = new java.util.ArrayList<String>();
412 }
413
414 return this.modules;
415 }
416
417
418
419
420
421
422
423 public void setLocation( Object key, InputLocation location )
424 {
425 if ( key instanceof String )
426 {
427 switch ( ( String ) key )
428 {
429 case "" :
430 {
431 this.location = location;
432 return;
433 }
434 case "modules" :
435 {
436 modulesLocation = location;
437 return;
438 }
439 case "distributionManagement" :
440 {
441 distributionManagementLocation = location;
442 return;
443 }
444 case "properties" :
445 {
446 propertiesLocation = location;
447 return;
448 }
449 case "dependencyManagement" :
450 {
451 dependencyManagementLocation = location;
452 return;
453 }
454 case "dependencies" :
455 {
456 dependenciesLocation = location;
457 return;
458 }
459 case "repositories" :
460 {
461 repositoriesLocation = location;
462 return;
463 }
464 case "pluginRepositories" :
465 {
466 pluginRepositoriesLocation = location;
467 return;
468 }
469 case "reports" :
470 {
471 reportsLocation = location;
472 return;
473 }
474 case "reporting" :
475 {
476 reportingLocation = location;
477 return;
478 }
479 default :
480 {
481 setOtherLocation( key, location );
482 return;
483 }
484 }
485 }
486 else
487 {
488 setOtherLocation( key, location );
489 }
490 }
491
492
493
494
495
496
497
498 public void setOtherLocation( Object key, InputLocation location )
499 {
500 if ( location != null )
501 {
502 if ( this.locations == null )
503 {
504 this.locations = new java.util.LinkedHashMap<Object, InputLocation>();
505 }
506 this.locations.put( key, location );
507 }
508 }
509
510
511
512
513
514
515
516 private InputLocation getOtherLocation( Object key )
517 {
518 return ( locations != null ) ? locations.get( key ) : null;
519 }
520
521
522
523
524
525
526 public java.util.List<Repository> getPluginRepositories()
527 {
528 if ( this.pluginRepositories == null )
529 {
530 this.pluginRepositories = new java.util.ArrayList<Repository>();
531 }
532
533 return this.pluginRepositories;
534 }
535
536
537
538
539
540
541 public java.util.Properties getProperties()
542 {
543 if ( this.properties == null )
544 {
545 this.properties = new java.util.Properties();
546 }
547
548 return this.properties;
549 }
550
551
552
553
554
555
556
557
558
559
560
561
562
563 public Reporting getReporting()
564 {
565 return this.reporting;
566 }
567
568
569
570
571
572
573 public Object getReports()
574 {
575 return this.reports;
576 }
577
578
579
580
581
582
583 public java.util.List<Repository> getRepositories()
584 {
585 if ( this.repositories == null )
586 {
587 this.repositories = new java.util.ArrayList<Repository>();
588 }
589
590 return this.repositories;
591 }
592
593
594
595
596
597
598 public void removeDependency( Dependency dependency )
599 {
600 getDependencies().remove( dependency );
601 }
602
603
604
605
606
607
608 public void removeModule( String string )
609 {
610 getModules().remove( string );
611 }
612
613
614
615
616
617
618 public void removePluginRepository( Repository repository )
619 {
620 getPluginRepositories().remove( repository );
621 }
622
623
624
625
626
627
628 public void removeRepository( Repository repository )
629 {
630 getRepositories().remove( repository );
631 }
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648 public void setDependencies( java.util.List<Dependency> dependencies )
649 {
650 this.dependencies = dependencies;
651 }
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666 public void setDependencyManagement( DependencyManagement dependencyManagement )
667 {
668 this.dependencyManagement = dependencyManagement;
669 }
670
671
672
673
674
675
676
677
678
679 public void setDistributionManagement( DistributionManagement distributionManagement )
680 {
681 this.distributionManagement = distributionManagement;
682 }
683
684
685
686
687
688
689
690
691
692
693
694
695 public void setModules( java.util.List<String> modules )
696 {
697 this.modules = modules;
698 }
699
700
701
702
703
704
705
706
707 public void setPluginRepositories( java.util.List<Repository> pluginRepositories )
708 {
709 this.pluginRepositories = pluginRepositories;
710 }
711
712
713
714
715
716
717
718
719
720
721 public void setProperties( java.util.Properties properties )
722 {
723 this.properties = properties;
724 }
725
726
727
728
729
730
731
732
733
734
735
736
737
738 public void setReporting( Reporting reporting )
739 {
740 this.reporting = reporting;
741 }
742
743
744
745
746
747
748 public void setReports( Object reports )
749 {
750 this.reports = reports;
751 }
752
753
754
755
756
757
758
759
760 public void setRepositories( java.util.List<Repository> repositories )
761 {
762 this.repositories = repositories;
763 }
764
765 }