View Javadoc
1   // =================== DO NOT EDIT THIS FILE ====================
2   // Generated by Modello 1.11,
3   // any modifications will be overwritten.
4   // ==============================================================
5   
6   package org.apache.maven.model;
7   
8   /**
9    * 
10   *         
11   *         The <code>&lt;parent&gt;</code> element contains
12   * information required to locate the parent project from which
13   *         this project will inherit from.
14   *         <strong>Note:</strong> The children of this element are
15   * not interpolated and must be given as literal values.
16   *         
17   *       
18   * 
19   * @version $Revision$ $Date$
20   */
21  @SuppressWarnings( "all" )
22  public class Parent
23      implements java.io.Serializable, java.lang.Cloneable, org.apache.maven.model.InputLocationTracker
24  {
25  
26        //--------------------------/
27       //- Class/Member Variables -/
28      //--------------------------/
29  
30      /**
31       * The group id of the parent project to inherit from.
32       */
33      private String groupId;
34  
35      /**
36       * The artifact id of the parent project to inherit from.
37       */
38      private String artifactId;
39  
40      /**
41       * The version of the parent project to inherit.
42       */
43      private String version;
44  
45      /**
46       * 
47       *             
48       *             The relative path of the parent
49       * <code>pom.xml</code> file within the check out.
50       *             If not specified, it defaults to
51       * <code>../pom.xml</code>.
52       *             Maven looks for the parent POM first in this
53       * location on
54       *             the filesystem, then the local repository, and
55       * lastly in the remote repo.
56       *             <code>relativePath</code> allows you to select a
57       * different location,
58       *             for example when your structure is flat, or
59       * deeper without an intermediate parent POM.
60       *             However, the group ID, artifact ID and version
61       * are still required,
62       *             and must match the file in the location given or
63       * it will revert to the repository for the POM.
64       *             This feature is only for enhancing the
65       * development in a local checkout of that project.
66       *             Set the value to an empty string in case you
67       * want to disable the feature and always resolve
68       *             the parent POM from the repositories.
69       *             
70       *           
71       */
72      private String relativePath = "../pom.xml";
73  
74      /**
75       * Field locations.
76       */
77      private java.util.Map<Object, InputLocation> locations;
78  
79      /**
80       * Field location.
81       */
82      private InputLocation location;
83  
84      /**
85       * Field groupIdLocation.
86       */
87      private InputLocation groupIdLocation;
88  
89      /**
90       * Field artifactIdLocation.
91       */
92      private InputLocation artifactIdLocation;
93  
94      /**
95       * Field versionLocation.
96       */
97      private InputLocation versionLocation;
98  
99      /**
100      * Field relativePathLocation.
101      */
102     private InputLocation relativePathLocation;
103 
104 
105       //-----------/
106      //- Methods -/
107     //-----------/
108 
109     /**
110      * Method clone.
111      * 
112      * @return Parent
113      */
114     public Parent clone()
115     {
116         try
117         {
118             Parent copy = (Parent) super.clone();
119 
120             if ( copy.locations != null )
121             {
122                 copy.locations = new java.util.LinkedHashMap( copy.locations );
123             }
124 
125             return copy;
126         }
127         catch ( java.lang.Exception ex )
128         {
129             throw (java.lang.RuntimeException) new java.lang.UnsupportedOperationException( getClass().getName()
130                 + " does not support clone()" ).initCause( ex );
131         }
132     } //-- Parent clone()
133 
134     /**
135      * Get the artifact id of the parent project to inherit from.
136      * 
137      * @return String
138      */
139     public String getArtifactId()
140     {
141         return this.artifactId;
142     } //-- String getArtifactId()
143 
144     /**
145      * Get the group id of the parent project to inherit from.
146      * 
147      * @return String
148      */
149     public String getGroupId()
150     {
151         return this.groupId;
152     } //-- String getGroupId()
153 
154     /**
155      * 
156      * 
157      * @param key
158      * @return InputLocation
159      */
160     public InputLocation getLocation( Object key )
161     {
162         if ( key instanceof String )
163         {
164             switch ( ( String ) key )
165             {
166                 case "" :
167                 {
168                     return this.location;
169                 }
170                 case "groupId" :
171                 {
172                     return groupIdLocation;
173                 }
174                 case "artifactId" :
175                 {
176                     return artifactIdLocation;
177                 }
178                 case "version" :
179                 {
180                     return versionLocation;
181                 }
182                 case "relativePath" :
183                 {
184                     return relativePathLocation;
185                 }
186                 default :
187                 {
188                     return getOtherLocation( key );
189                 }
190                 }
191             }
192             else
193             {
194                 return getOtherLocation( key );
195             }
196     } //-- InputLocation getLocation( Object )
197 
198     /**
199      * 
200      * 
201      * @param key
202      * @param location
203      */
204     public void setLocation( Object key, InputLocation location )
205     {
206         if ( key instanceof String )
207         {
208             switch ( ( String ) key )
209             {
210                 case "" :
211                 {
212                     this.location = location;
213                     return;
214                 }
215                 case "groupId" :
216                 {
217                     groupIdLocation = location;
218                     return;
219                 }
220                 case "artifactId" :
221                 {
222                     artifactIdLocation = location;
223                     return;
224                 }
225                 case "version" :
226                 {
227                     versionLocation = location;
228                     return;
229                 }
230                 case "relativePath" :
231                 {
232                     relativePathLocation = location;
233                     return;
234                 }
235                 default :
236                 {
237                     setOtherLocation( key, location );
238                     return;
239                 }
240                 }
241             }
242             else
243             {
244                 setOtherLocation( key, location );
245             }
246     } //-- void setLocation( Object, InputLocation )
247 
248     /**
249      * 
250      * 
251      * @param key
252      * @param location
253      */
254     public void setOtherLocation( Object key, InputLocation location )
255     {
256         if ( location != null )
257         {
258             if ( this.locations == null )
259             {
260                 this.locations = new java.util.LinkedHashMap<Object, InputLocation>();
261             }
262             this.locations.put( key, location );
263         }
264     } //-- void setOtherLocation( Object, InputLocation )
265 
266     /**
267      * 
268      * 
269      * @param key
270      * @return InputLocation
271      */
272     private InputLocation getOtherLocation( Object key )
273     {
274         return ( locations != null ) ? locations.get( key ) : null;
275     } //-- InputLocation getOtherLocation( Object )
276 
277     /**
278      * Get the relative path of the parent <code>pom.xml</code>
279      * file within the check out.
280      *             If not specified, it defaults to
281      * <code>../pom.xml</code>.
282      *             Maven looks for the parent POM first in this
283      * location on
284      *             the filesystem, then the local repository, and
285      * lastly in the remote repo.
286      *             <code>relativePath</code> allows you to select a
287      * different location,
288      *             for example when your structure is flat, or
289      * deeper without an intermediate parent POM.
290      *             However, the group ID, artifact ID and version
291      * are still required,
292      *             and must match the file in the location given or
293      * it will revert to the repository for the POM.
294      *             This feature is only for enhancing the
295      * development in a local checkout of that project.
296      *             Set the value to an empty string in case you
297      * want to disable the feature and always resolve
298      *             the parent POM from the repositories.
299      * 
300      * @return String
301      */
302     public String getRelativePath()
303     {
304         return this.relativePath;
305     } //-- String getRelativePath()
306 
307     /**
308      * Get the version of the parent project to inherit.
309      * 
310      * @return String
311      */
312     public String getVersion()
313     {
314         return this.version;
315     } //-- String getVersion()
316 
317     /**
318      * Set the artifact id of the parent project to inherit from.
319      * 
320      * @param artifactId
321      */
322     public void setArtifactId( String artifactId )
323     {
324         this.artifactId = artifactId;
325     } //-- void setArtifactId( String )
326 
327     /**
328      * Set the group id of the parent project to inherit from.
329      * 
330      * @param groupId
331      */
332     public void setGroupId( String groupId )
333     {
334         this.groupId = groupId;
335     } //-- void setGroupId( String )
336 
337     /**
338      * Set the relative path of the parent <code>pom.xml</code>
339      * file within the check out.
340      *             If not specified, it defaults to
341      * <code>../pom.xml</code>.
342      *             Maven looks for the parent POM first in this
343      * location on
344      *             the filesystem, then the local repository, and
345      * lastly in the remote repo.
346      *             <code>relativePath</code> allows you to select a
347      * different location,
348      *             for example when your structure is flat, or
349      * deeper without an intermediate parent POM.
350      *             However, the group ID, artifact ID and version
351      * are still required,
352      *             and must match the file in the location given or
353      * it will revert to the repository for the POM.
354      *             This feature is only for enhancing the
355      * development in a local checkout of that project.
356      *             Set the value to an empty string in case you
357      * want to disable the feature and always resolve
358      *             the parent POM from the repositories.
359      * 
360      * @param relativePath
361      */
362     public void setRelativePath( String relativePath )
363     {
364         this.relativePath = relativePath;
365     } //-- void setRelativePath( String )
366 
367     /**
368      * Set the version of the parent project to inherit.
369      * 
370      * @param version
371      */
372     public void setVersion( String version )
373     {
374         this.version = version;
375     } //-- void setVersion( String )
376 
377     
378             
379     /**
380      * @return the id as <code>groupId:artifactId:version</code>
381      */
382     public String getId()
383     {
384         StringBuilder id = new StringBuilder( 64 );
385 
386         id.append( getGroupId() );
387         id.append( ":" );
388         id.append( getArtifactId() );
389         id.append( ":" );
390         id.append( "pom" );
391         id.append( ":" );
392         id.append( getVersion() );
393 
394         return id.toString();
395     }
396 
397     @Override
398     public String toString()
399     {
400         return getId();
401     }
402             
403           
404 }