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