View Javadoc

1   /*
2    =================== DO NOT EDIT THIS FILE ====================
3    Generated by Modello 1.4.1 on 2012-01-20 18:05:12,
4    any modifications will be overwritten.
5    ==============================================================
6    */
7   
8   package org.apache.maven.model;
9   
10  /**
11   * 
12   *         
13   *         The <code>&lt;parent&gt;</code> element contains
14   * information required to locate the parent project from which
15   *         this project will inherit from.
16   *         <strong>Note:</strong> The children of this element are
17   * not interpolated and must be given as literal values.
18   *         
19   *       
20   * 
21   * @version $Revision$ $Date$
22   */
23  @SuppressWarnings( "all" )
24  public class Parent
25      implements java.io.Serializable, java.lang.Cloneable, org.apache.maven.model.InputLocationTracker
26  {
27  
28        //--------------------------/
29       //- Class/Member Variables -/
30      //--------------------------/
31  
32      /**
33       * The group id of the parent project to inherit from.
34       */
35      private String groupId;
36  
37      /**
38       * The artifact id of the parent project to inherit from.
39       */
40      private String artifactId;
41  
42      /**
43       * The version of the parent project to inherit.
44       */
45      private String version;
46  
47      /**
48       * 
49       *             
50       *             The relative path of the parent
51       * <code>pom.xml</code> file within the check out.
52       *             If not specified, it defaults to
53       * <code>../pom.xml</code>.
54       *             Maven looks for the parent POM first in this
55       * location on
56       *             the filesystem, then the local repository, and
57       * lastly in the remote repo.
58       *             <code>relativePath</code> allows you to select a
59       * different location,
60       *             for example when your structure is flat, or
61       * deeper without an intermediate parent POM.
62       *             However, the group ID, artifact ID and version
63       * are still required,
64       *             and must match the file in the location given or
65       * it will revert to the repository for the POM.
66       *             This feature is only for enhancing the
67       * development in a local checkout of that project.
68       *             Set the value to an empty string in case you
69       * want to disable the feature and always resolve
70       *             the parent POM from the repositories.
71       *             
72       *           
73       */
74      private String relativePath = "../pom.xml";
75  
76      /**
77       * Field locations.
78       */
79      private java.util.Map<Object, InputLocation> locations;
80  
81  
82        //-----------/
83       //- Methods -/
84      //-----------/
85  
86      /**
87       * Method clone.
88       * 
89       * @return Parent
90       */
91      public Parent clone()
92      {
93          try
94          {
95              Parent copy = (Parent) super.clone();
96  
97              if ( copy.locations != null )
98              {
99                  copy.locations = new java.util.LinkedHashMap( copy.locations );
100             }
101 
102             return copy;
103         }
104         catch ( java.lang.Exception ex )
105         {
106             throw (java.lang.RuntimeException) new java.lang.UnsupportedOperationException( getClass().getName()
107                 + " does not support clone()" ).initCause( ex );
108         }
109     } //-- Parent clone()
110 
111     /**
112      * Get the artifact id of the parent project to inherit from.
113      * 
114      * @return String
115      */
116     public String getArtifactId()
117     {
118         return this.artifactId;
119     } //-- String getArtifactId()
120 
121     /**
122      * Get the group id of the parent project to inherit from.
123      * 
124      * @return String
125      */
126     public String getGroupId()
127     {
128         return this.groupId;
129     } //-- String getGroupId()
130 
131     /**
132      * 
133      * 
134      * @param key
135      * @return InputLocation
136      */
137     public InputLocation getLocation( Object key )
138     {
139         return ( locations != null ) ? locations.get( key ) : null;
140     } //-- InputLocation getLocation( Object )
141 
142     /**
143      * Get the relative path of the parent <code>pom.xml</code>
144      * file within the check out.
145      *             If not specified, it defaults to
146      * <code>../pom.xml</code>.
147      *             Maven looks for the parent POM first in this
148      * location on
149      *             the filesystem, then the local repository, and
150      * lastly in the remote repo.
151      *             <code>relativePath</code> allows you to select a
152      * different location,
153      *             for example when your structure is flat, or
154      * deeper without an intermediate parent POM.
155      *             However, the group ID, artifact ID and version
156      * are still required,
157      *             and must match the file in the location given or
158      * it will revert to the repository for the POM.
159      *             This feature is only for enhancing the
160      * development in a local checkout of that project.
161      *             Set the value to an empty string in case you
162      * want to disable the feature and always resolve
163      *             the parent POM from the repositories.
164      * 
165      * @return String
166      */
167     public String getRelativePath()
168     {
169         return this.relativePath;
170     } //-- String getRelativePath()
171 
172     /**
173      * Get the version of the parent project to inherit.
174      * 
175      * @return String
176      */
177     public String getVersion()
178     {
179         return this.version;
180     } //-- String getVersion()
181 
182     /**
183      * Set the artifact id of the parent project to inherit from.
184      * 
185      * @param artifactId
186      */
187     public void setArtifactId( String artifactId )
188     {
189         this.artifactId = artifactId;
190     } //-- void setArtifactId( String )
191 
192     /**
193      * Set the group id of the parent project to inherit from.
194      * 
195      * @param groupId
196      */
197     public void setGroupId( String groupId )
198     {
199         this.groupId = groupId;
200     } //-- void setGroupId( String )
201 
202     /**
203      * 
204      * 
205      * @param key
206      * @param location
207      */
208     public void setLocation( Object key, InputLocation location )
209     {
210         if ( location != null )
211         {
212             if ( this.locations == null )
213             {
214                 this.locations = new java.util.LinkedHashMap<Object, InputLocation>();
215             }
216             this.locations.put( key, location );
217         }
218     } //-- void setLocation( Object, InputLocation )
219 
220     /**
221      * Set the relative path of the parent <code>pom.xml</code>
222      * file within the check out.
223      *             If not specified, it defaults to
224      * <code>../pom.xml</code>.
225      *             Maven looks for the parent POM first in this
226      * location on
227      *             the filesystem, then the local repository, and
228      * lastly in the remote repo.
229      *             <code>relativePath</code> allows you to select a
230      * different location,
231      *             for example when your structure is flat, or
232      * deeper without an intermediate parent POM.
233      *             However, the group ID, artifact ID and version
234      * are still required,
235      *             and must match the file in the location given or
236      * it will revert to the repository for the POM.
237      *             This feature is only for enhancing the
238      * development in a local checkout of that project.
239      *             Set the value to an empty string in case you
240      * want to disable the feature and always resolve
241      *             the parent POM from the repositories.
242      * 
243      * @param relativePath
244      */
245     public void setRelativePath( String relativePath )
246     {
247         this.relativePath = relativePath;
248     } //-- void setRelativePath( String )
249 
250     /**
251      * Set the version of the parent project to inherit.
252      * 
253      * @param version
254      */
255     public void setVersion( String version )
256     {
257         this.version = version;
258     } //-- void setVersion( String )
259 
260     
261             
262     /**
263      * @return the id as <code>groupId:artifactId:version</code>
264      */
265     public String getId()
266     {
267         StringBuilder id = new StringBuilder( 64 );
268 
269         id.append( getGroupId() );
270         id.append( ":" );
271         id.append( getArtifactId() );
272         id.append( ":" );
273         id.append( "pom" );
274         id.append( ":" );
275         id.append( getVersion() );
276 
277         return id.toString();
278     }
279 
280     @Override
281     public String toString()
282     {
283         return getId();
284     }
285             
286           
287 }