001 /*
002 =================== DO NOT EDIT THIS FILE ====================
003 Generated by Modello 1.4.1 on 2012-01-20 18:05:12,
004 any modifications will be overwritten.
005 ==============================================================
006 */
007
008 package org.apache.maven.model;
009
010 /**
011 *
012 *
013 * The <code><parent></code> element contains
014 * information required to locate the parent project from which
015 * this project will inherit from.
016 * <strong>Note:</strong> The children of this element are
017 * not interpolated and must be given as literal values.
018 *
019 *
020 *
021 * @version $Revision$ $Date$
022 */
023 @SuppressWarnings( "all" )
024 public class Parent
025 implements java.io.Serializable, java.lang.Cloneable, org.apache.maven.model.InputLocationTracker
026 {
027
028 //--------------------------/
029 //- Class/Member Variables -/
030 //--------------------------/
031
032 /**
033 * The group id of the parent project to inherit from.
034 */
035 private String groupId;
036
037 /**
038 * The artifact id of the parent project to inherit from.
039 */
040 private String artifactId;
041
042 /**
043 * The version of the parent project to inherit.
044 */
045 private String version;
046
047 /**
048 *
049 *
050 * The relative path of the parent
051 * <code>pom.xml</code> file within the check out.
052 * If not specified, it defaults to
053 * <code>../pom.xml</code>.
054 * Maven looks for the parent POM first in this
055 * location on
056 * the filesystem, then the local repository, and
057 * lastly in the remote repo.
058 * <code>relativePath</code> allows you to select a
059 * different location,
060 * for example when your structure is flat, or
061 * deeper without an intermediate parent POM.
062 * However, the group ID, artifact ID and version
063 * are still required,
064 * and must match the file in the location given or
065 * it will revert to the repository for the POM.
066 * This feature is only for enhancing the
067 * development in a local checkout of that project.
068 * Set the value to an empty string in case you
069 * want to disable the feature and always resolve
070 * the parent POM from the repositories.
071 *
072 *
073 */
074 private String relativePath = "../pom.xml";
075
076 /**
077 * Field locations.
078 */
079 private java.util.Map<Object, InputLocation> locations;
080
081
082 //-----------/
083 //- Methods -/
084 //-----------/
085
086 /**
087 * Method clone.
088 *
089 * @return Parent
090 */
091 public Parent clone()
092 {
093 try
094 {
095 Parent copy = (Parent) super.clone();
096
097 if ( copy.locations != null )
098 {
099 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 }