View Javadoc

1   // =================== DO NOT EDIT THIS FILE ====================
2   // Generated by Modello 1.8.1,
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        //-----------/
81       //- Methods -/
82      //-----------/
83  
84      /**
85       * Method clone.
86       * 
87       * @return Parent
88       */
89      public Parent clone()
90      {
91          try
92          {
93              Parent copy = (Parent) super.clone();
94  
95              if ( copy.locations != null )
96              {
97                  copy.locations = new java.util.LinkedHashMap( copy.locations );
98              }
99  
100             return copy;
101         }
102         catch ( java.lang.Exception ex )
103         {
104             throw (java.lang.RuntimeException) new java.lang.UnsupportedOperationException( getClass().getName()
105                 + " does not support clone()" ).initCause( ex );
106         }
107     } //-- Parent clone()
108 
109     /**
110      * Get the artifact id of the parent project to inherit from.
111      * 
112      * @return String
113      */
114     public String getArtifactId()
115     {
116         return this.artifactId;
117     } //-- String getArtifactId()
118 
119     /**
120      * Get the group id of the parent project to inherit from.
121      * 
122      * @return String
123      */
124     public String getGroupId()
125     {
126         return this.groupId;
127     } //-- String getGroupId()
128 
129     /**
130      * 
131      * 
132      * @param key
133      * @return InputLocation
134      */
135     public InputLocation getLocation( Object key )
136     {
137         return ( locations != null ) ? locations.get( key ) : null;
138     } //-- InputLocation getLocation( Object )
139 
140     /**
141      * Get the relative path of the parent <code>pom.xml</code>
142      * file within the check out.
143      *             If not specified, it defaults to
144      * <code>../pom.xml</code>.
145      *             Maven looks for the parent POM first in this
146      * location on
147      *             the filesystem, then the local repository, and
148      * lastly in the remote repo.
149      *             <code>relativePath</code> allows you to select a
150      * different location,
151      *             for example when your structure is flat, or
152      * deeper without an intermediate parent POM.
153      *             However, the group ID, artifact ID and version
154      * are still required,
155      *             and must match the file in the location given or
156      * it will revert to the repository for the POM.
157      *             This feature is only for enhancing the
158      * development in a local checkout of that project.
159      *             Set the value to an empty string in case you
160      * want to disable the feature and always resolve
161      *             the parent POM from the repositories.
162      * 
163      * @return String
164      */
165     public String getRelativePath()
166     {
167         return this.relativePath;
168     } //-- String getRelativePath()
169 
170     /**
171      * Get the version of the parent project to inherit.
172      * 
173      * @return String
174      */
175     public String getVersion()
176     {
177         return this.version;
178     } //-- String getVersion()
179 
180     /**
181      * Set the artifact id of the parent project to inherit from.
182      * 
183      * @param artifactId
184      */
185     public void setArtifactId( String artifactId )
186     {
187         this.artifactId = artifactId;
188     } //-- void setArtifactId( String )
189 
190     /**
191      * Set the group id of the parent project to inherit from.
192      * 
193      * @param groupId
194      */
195     public void setGroupId( String groupId )
196     {
197         this.groupId = groupId;
198     } //-- void setGroupId( String )
199 
200     /**
201      * 
202      * 
203      * @param key
204      * @param location
205      */
206     public void setLocation( Object key, InputLocation location )
207     {
208         if ( location != null )
209         {
210             if ( this.locations == null )
211             {
212                 this.locations = new java.util.LinkedHashMap<Object, InputLocation>();
213             }
214             this.locations.put( key, location );
215         }
216     } //-- void setLocation( Object, InputLocation )
217 
218     /**
219      * Set the relative path of the parent <code>pom.xml</code>
220      * file within the check out.
221      *             If not specified, it defaults to
222      * <code>../pom.xml</code>.
223      *             Maven looks for the parent POM first in this
224      * location on
225      *             the filesystem, then the local repository, and
226      * lastly in the remote repo.
227      *             <code>relativePath</code> allows you to select a
228      * different location,
229      *             for example when your structure is flat, or
230      * deeper without an intermediate parent POM.
231      *             However, the group ID, artifact ID and version
232      * are still required,
233      *             and must match the file in the location given or
234      * it will revert to the repository for the POM.
235      *             This feature is only for enhancing the
236      * development in a local checkout of that project.
237      *             Set the value to an empty string in case you
238      * want to disable the feature and always resolve
239      *             the parent POM from the repositories.
240      * 
241      * @param relativePath
242      */
243     public void setRelativePath( String relativePath )
244     {
245         this.relativePath = relativePath;
246     } //-- void setRelativePath( String )
247 
248     /**
249      * Set the version of the parent project to inherit.
250      * 
251      * @param version
252      */
253     public void setVersion( String version )
254     {
255         this.version = version;
256     } //-- void setVersion( String )
257 
258     
259             
260     /**
261      * @return the id as <code>groupId:artifactId:version</code>
262      */
263     public String getId()
264     {
265         StringBuilder id = new StringBuilder( 64 );
266 
267         id.append( getGroupId() );
268         id.append( ":" );
269         id.append( getArtifactId() );
270         id.append( ":" );
271         id.append( "pom" );
272         id.append( ":" );
273         id.append( getVersion() );
274 
275         return id.toString();
276     }
277 
278     @Override
279     public String toString()
280     {
281         return getId();
282     }
283             
284           
285 }