View Javadoc
1   /*
2    Licensed to the Apache Software Foundation (ASF) under one
3    or more contributor license agreements.  See the NOTICE file
4    distributed with this work for additional information
5    regarding copyright ownership.  The ASF licenses this file
6    to you under the Apache License, Version 2.0 (the
7    "License"); you may not use this file except in compliance
8    with the License.  You may obtain a copy of the License at
9    
10       http://www.apache.org/licenses/LICENSE-2.0
11   
12   Unless required by applicable law or agreed to in writing,
13   software distributed under the License is distributed on an
14   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   KIND, either express or implied.  See the License for the
16   specific language governing permissions and limitations
17   under the License.
18   =================== DO NOT EDIT THIS FILE ====================
19   Generated by Modello 2.4.0,
20   any modifications will be overwritten.
21   ==============================================================
22   */
23  
24  package org.apache.maven.model;
25  
26  /**
27   * 
28   *         
29   *         Base class for the <code>Model</code> and the
30   * <code>Profile</code> objects.
31   *         
32   *       
33   * 
34   * @version $Revision$ $Date$
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       //- Class/Member Variables -/
43      //--------------------------/
44  
45      /**
46       * Field modules.
47       */
48      private java.util.List<String> modules;
49  
50      /**
51       * Distribution information for a project that enables
52       * deployment of the site
53       *             and artifacts to remote web servers and
54       * repositories respectively.
55       */
56      private DistributionManagement distributionManagement;
57  
58      /**
59       * Field properties.
60       */
61      private java.util.Properties properties;
62  
63      /**
64       * Default dependency information for projects that inherit
65       * from this one. The
66       *             dependencies in this section are not immediately
67       * resolved. Instead, when a POM derived
68       *             from this one declares a dependency described by
69       * a matching groupId and artifactId, the
70       *             version and other values from this section are
71       * used for that dependency if they were not
72       *             already specified.
73       */
74      private DependencyManagement dependencyManagement;
75  
76      /**
77       * Field dependencies.
78       */
79      private java.util.List<Dependency> dependencies;
80  
81      /**
82       * Field repositories.
83       */
84      private java.util.List<Repository> repositories;
85  
86      /**
87       * Field pluginRepositories.
88       */
89      private java.util.List<Repository> pluginRepositories;
90  
91      /**
92       * 
93       *             
94       *             <b>Deprecated</b>. Now ignored by Maven.
95       *             
96       *           
97       */
98      private Object reports;
99  
100     /**
101      * 
102      *             
103      *             This element includes the specification of
104      * report plugins to use
105      *             to generate the reports on the Maven-generated
106      * site.
107      *             These reports will be run when a user executes
108      * <code>mvn site</code>.
109      *             All of the reports will be included in the
110      * navigation bar for browsing.
111      *             
112      *           
113      */
114     private Reporting reporting;
115 
116     /**
117      * Field locations.
118      */
119     private java.util.Map<Object, InputLocation> locations;
120 
121     /**
122      * Field location.
123      */
124     private InputLocation location;
125 
126     /**
127      * Field modulesLocation.
128      */
129     private InputLocation modulesLocation;
130 
131     /**
132      * Field distributionManagementLocation.
133      */
134     private InputLocation distributionManagementLocation;
135 
136     /**
137      * Field propertiesLocation.
138      */
139     private InputLocation propertiesLocation;
140 
141     /**
142      * Field dependencyManagementLocation.
143      */
144     private InputLocation dependencyManagementLocation;
145 
146     /**
147      * Field dependenciesLocation.
148      */
149     private InputLocation dependenciesLocation;
150 
151     /**
152      * Field repositoriesLocation.
153      */
154     private InputLocation repositoriesLocation;
155 
156     /**
157      * Field pluginRepositoriesLocation.
158      */
159     private InputLocation pluginRepositoriesLocation;
160 
161     /**
162      * Field reportsLocation.
163      */
164     private InputLocation reportsLocation;
165 
166     /**
167      * Field reportingLocation.
168      */
169     private InputLocation reportingLocation;
170 
171 
172       //-----------/
173      //- Methods -/
174     //-----------/
175 
176     /**
177      * Method addDependency.
178      * 
179      * @param dependency a dependency object.
180      */
181     public void addDependency( Dependency dependency )
182     {
183         getDependencies().add( dependency );
184     } //-- void addDependency( Dependency )
185 
186     /**
187      * Method addModule.
188      * 
189      * @param string a string object.
190      */
191     public void addModule( String string )
192     {
193         getModules().add( string );
194     } //-- void addModule( String )
195 
196     /**
197      * Method addPluginRepository.
198      * 
199      * @param repository a repository object.
200      */
201     public void addPluginRepository( Repository repository )
202     {
203         getPluginRepositories().add( repository );
204     } //-- void addPluginRepository( Repository )
205 
206     /**
207      * Method addProperty.
208      * 
209      * @param key a key object.
210      * @param value a value object.
211      */
212     public void addProperty( String key, String value )
213     {
214         getProperties().put( key, value );
215     } //-- void addProperty( String, String )
216 
217     /**
218      * Method addRepository.
219      * 
220      * @param repository a repository object.
221      */
222     public void addRepository( Repository repository )
223     {
224         getRepositories().add( repository );
225     } //-- void addRepository( Repository )
226 
227     /**
228      * Method clone.
229      * 
230      * @return ModelBase
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     } //-- ModelBase clone()
309 
310     /**
311      * Method getDependencies.
312      * 
313      * @return List
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     } //-- java.util.List<Dependency> getDependencies()
324 
325     /**
326      * Get default dependency information for projects that inherit
327      * from this one. The
328      *             dependencies in this section are not immediately
329      * resolved. Instead, when a POM derived
330      *             from this one declares a dependency described by
331      * a matching groupId and artifactId, the
332      *             version and other values from this section are
333      * used for that dependency if they were not
334      *             already specified.
335      * 
336      * @return DependencyManagement
337      */
338     public DependencyManagement getDependencyManagement()
339     {
340         return this.dependencyManagement;
341     } //-- DependencyManagement getDependencyManagement()
342 
343     /**
344      * Get distribution information for a project that enables
345      * deployment of the site
346      *             and artifacts to remote web servers and
347      * repositories respectively.
348      * 
349      * @return DistributionManagement
350      */
351     public DistributionManagement getDistributionManagement()
352     {
353         return this.distributionManagement;
354     } //-- DistributionManagement getDistributionManagement()
355 
356     /**
357      * 
358      * 
359      * @param key a key object.
360      * @return InputLocation
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     } //-- InputLocation getLocation( Object )
419 
420     /**
421      * Method getModules.
422      * 
423      * @return List
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     } //-- java.util.List<String> getModules()
434 
435     /**
436      * 
437      * 
438      * @param key a key object.
439      * @param location a location object.
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     } //-- void setLocation( Object, InputLocation )
509 
510     /**
511      * 
512      * 
513      * @param key a key object.
514      * @param location a location object.
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     } //-- void setOtherLocation( Object, InputLocation )
527 
528     /**
529      * 
530      * 
531      * @param key a key object.
532      * @return InputLocation
533      */
534     private InputLocation getOtherLocation( Object key )
535     {
536         return ( locations != null ) ? locations.get( key ) : null;
537     } //-- InputLocation getOtherLocation( Object )
538 
539     /**
540      * Method getPluginRepositories.
541      * 
542      * @return List
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     } //-- java.util.List<Repository> getPluginRepositories()
553 
554     /**
555      * Method getProperties.
556      * 
557      * @return Properties
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     } //-- java.util.Properties getProperties()
568 
569     /**
570      * Get this element includes the specification of report
571      * plugins to use
572      *             to generate the reports on the Maven-generated
573      * site.
574      *             These reports will be run when a user executes
575      * <code>mvn site</code>.
576      *             All of the reports will be included in the
577      * navigation bar for browsing.
578      * 
579      * @return Reporting
580      */
581     public Reporting getReporting()
582     {
583         return this.reporting;
584     } //-- Reporting getReporting()
585 
586     /**
587      * Get <b>Deprecated</b>. Now ignored by Maven.
588      * 
589      * @return Object
590      */
591     public Object getReports()
592     {
593         return this.reports;
594     } //-- Object getReports()
595 
596     /**
597      * Method getRepositories.
598      * 
599      * @return List
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     } //-- java.util.List<Repository> getRepositories()
610 
611     /**
612      * Method removeDependency.
613      * 
614      * @param dependency a dependency object.
615      */
616     public void removeDependency( Dependency dependency )
617     {
618         getDependencies().remove( dependency );
619     } //-- void removeDependency( Dependency )
620 
621     /**
622      * Method removeModule.
623      * 
624      * @param string a string object.
625      */
626     public void removeModule( String string )
627     {
628         getModules().remove( string );
629     } //-- void removeModule( String )
630 
631     /**
632      * Method removePluginRepository.
633      * 
634      * @param repository a repository object.
635      */
636     public void removePluginRepository( Repository repository )
637     {
638         getPluginRepositories().remove( repository );
639     } //-- void removePluginRepository( Repository )
640 
641     /**
642      * Method removeRepository.
643      * 
644      * @param repository a repository object.
645      */
646     public void removeRepository( Repository repository )
647     {
648         getRepositories().remove( repository );
649     } //-- void removeRepository( Repository )
650 
651     /**
652      * Set this element describes all of the dependencies
653      * associated with a
654      *             project.
655      *             These dependencies are used to construct a
656      * classpath for your
657      *             project during the build process. They are
658      * automatically downloaded from the
659      *             repositories defined in this project.
660      *             See <a
661      * href="https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html">the
662      *             dependency mechanism</a> for more information.
663      * 
664      * @param dependencies a dependencies object.
665      */
666     public void setDependencies( java.util.List<Dependency> dependencies )
667     {
668         this.dependencies = dependencies;
669     } //-- void setDependencies( java.util.List )
670 
671     /**
672      * Set default dependency information for projects that inherit
673      * from this one. The
674      *             dependencies in this section are not immediately
675      * resolved. Instead, when a POM derived
676      *             from this one declares a dependency described by
677      * a matching groupId and artifactId, the
678      *             version and other values from this section are
679      * used for that dependency if they were not
680      *             already specified.
681      * 
682      * @param dependencyManagement a dependencyManagement object.
683      */
684     public void setDependencyManagement( DependencyManagement dependencyManagement )
685     {
686         this.dependencyManagement = dependencyManagement;
687     } //-- void setDependencyManagement( DependencyManagement )
688 
689     /**
690      * Set distribution information for a project that enables
691      * deployment of the site
692      *             and artifacts to remote web servers and
693      * repositories respectively.
694      * 
695      * @param distributionManagement a distributionManagement object
696      */
697     public void setDistributionManagement( DistributionManagement distributionManagement )
698     {
699         this.distributionManagement = distributionManagement;
700     } //-- void setDistributionManagement( DistributionManagement )
701 
702     /**
703      * Set the modules (sometimes called subprojects) to build as a
704      * part of this
705      *             project. Each module listed is a relative path
706      * to the directory containing the module.
707      *             To be consistent with the way default urls are
708      * calculated from parent, it is recommended
709      *             to have module names match artifact ids.
710      * 
711      * @param modules a modules object.
712      */
713     public void setModules( java.util.List<String> modules )
714     {
715         this.modules = modules;
716     } //-- void setModules( java.util.List )
717 
718     /**
719      * Set the lists of the remote repositories for discovering
720      * plugins for builds and
721      *             reports.
722      * 
723      * @param pluginRepositories a pluginRepositories object.
724      */
725     public void setPluginRepositories( java.util.List<Repository> pluginRepositories )
726     {
727         this.pluginRepositories = pluginRepositories;
728     } //-- void setPluginRepositories( java.util.List )
729 
730     /**
731      * Set properties that can be used throughout the POM as a
732      * substitution, and
733      *             are used as filters in resources if enabled.
734      *             The format is
735      * <code>&lt;name&gt;value&lt;/name&gt;</code>.
736      * 
737      * @param properties a properties object.
738      */
739     public void setProperties( java.util.Properties properties )
740     {
741         this.properties = properties;
742     } //-- void setProperties( java.util.Properties )
743 
744     /**
745      * Set this element includes the specification of report
746      * plugins to use
747      *             to generate the reports on the Maven-generated
748      * site.
749      *             These reports will be run when a user executes
750      * <code>mvn site</code>.
751      *             All of the reports will be included in the
752      * navigation bar for browsing.
753      * 
754      * @param reporting a reporting object.
755      */
756     public void setReporting( Reporting reporting )
757     {
758         this.reporting = reporting;
759     } //-- void setReporting( Reporting )
760 
761     /**
762      * Set <b>Deprecated</b>. Now ignored by Maven.
763      * 
764      * @param reports a reports object.
765      */
766     public void setReports( Object reports )
767     {
768         this.reports = reports;
769     } //-- void setReports( Object )
770 
771     /**
772      * Set the lists of the remote repositories for discovering
773      * dependencies and
774      *             extensions.
775      * 
776      * @param repositories a repositories object.
777      */
778     public void setRepositories( java.util.List<Repository> repositories )
779     {
780         this.repositories = repositories;
781     } //-- void setRepositories( java.util.List )
782 
783 }