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.archetype.catalog;
25  
26  /**
27   * Information to point to an Archetype referenced in the catalog.
28   * 
29   * @version $Revision$ $Date$
30   */
31  @SuppressWarnings( "all" )
32  public class Archetype
33      implements java.io.Serializable
34  {
35  
36        //--------------------------/
37       //- Class/Member Variables -/
38      //--------------------------/
39  
40      /**
41       * The groupId of the archetype.
42       */
43      private String groupId;
44  
45      /**
46       * The artifactId of the archetype.
47       */
48      private String artifactId;
49  
50      /**
51       * The version of the archetype. <code>RELEASE</code> is a
52       * valid version.
53       */
54      private String version;
55  
56      /**
57       * The URL of the repository where to find the archetype.
58       *            When omitted, the archetype is searched for in
59       * the repository where the catalog comes from.
60       */
61      @Deprecated
62      private String repository;
63  
64      /**
65       * The description of the archetype.
66       */
67      private String description;
68  
69      /**
70       * Field goals.
71       */
72      private java.util.List<String> goals;
73  
74      /**
75       * Field properties.
76       */
77      private java.util.Properties properties;
78  
79  
80        //-----------/
81       //- Methods -/
82      //-----------/
83  
84      /**
85       * Method addGoal.
86       * 
87       * @param string a string object.
88       */
89      public void addGoal( String string )
90      {
91          getGoals().add( string );
92      } //-- void addGoal( String )
93  
94      /**
95       * Method addProperty.
96       * 
97       * @param key a key object.
98       * @param value a value object.
99       */
100     public void addProperty( String key, String value )
101     {
102         getProperties().put( key, value );
103     } //-- void addProperty( String, String )
104 
105     /**
106      * Get the artifactId of the archetype.
107      * 
108      * @return String
109      */
110     public String getArtifactId()
111     {
112         return this.artifactId;
113     } //-- String getArtifactId()
114 
115     /**
116      * Get the description of the archetype.
117      * 
118      * @return String
119      */
120     public String getDescription()
121     {
122         return this.description;
123     } //-- String getDescription()
124 
125     /**
126      * Method getGoals.
127      * 
128      * @return List
129      */
130     public java.util.List<String> getGoals()
131     {
132         if ( this.goals == null )
133         {
134             this.goals = new java.util.ArrayList<String>();
135         }
136 
137         return this.goals;
138     } //-- java.util.List<String> getGoals()
139 
140     /**
141      * Get the groupId of the archetype.
142      * 
143      * @return String
144      */
145     public String getGroupId()
146     {
147         return this.groupId;
148     } //-- String getGroupId()
149 
150     /**
151      * Method getProperties.
152      * 
153      * @return Properties
154      */
155     public java.util.Properties getProperties()
156     {
157         if ( this.properties == null )
158         {
159             this.properties = new java.util.Properties();
160         }
161 
162         return this.properties;
163     } //-- java.util.Properties getProperties()
164 
165     /**
166      * Get the URL of the repository where to find the archetype.
167      *            When omitted, the archetype is searched for in
168      * the repository where the catalog comes from.
169      * 
170      * @return String
171      */
172     public String getRepository()
173     {
174         return this.repository;
175     } //-- String getRepository()
176 
177     /**
178      * Get the version of the archetype. <code>RELEASE</code> is a
179      * valid version.
180      * 
181      * @return String
182      */
183     public String getVersion()
184     {
185         return this.version;
186     } //-- String getVersion()
187 
188     /**
189      * Method removeGoal.
190      * 
191      * @param string a string object.
192      */
193     public void removeGoal( String string )
194     {
195         getGoals().remove( string );
196     } //-- void removeGoal( String )
197 
198     /**
199      * Set the artifactId of the archetype.
200      * 
201      * @param artifactId a artifactId object.
202      */
203     public void setArtifactId( String artifactId )
204     {
205         this.artifactId = artifactId;
206     } //-- void setArtifactId( String )
207 
208     /**
209      * Set the description of the archetype.
210      * 
211      * @param description a description object.
212      */
213     public void setDescription( String description )
214     {
215         this.description = description;
216     } //-- void setDescription( String )
217 
218     /**
219      * Set goals to execute after the creation of the project.
220      * 
221      * @param goals a goals object.
222      */
223     public void setGoals( java.util.List<String> goals )
224     {
225         this.goals = goals;
226     } //-- void setGoals( java.util.List )
227 
228     /**
229      * Set the groupId of the archetype.
230      * 
231      * @param groupId a groupId object.
232      */
233     public void setGroupId( String groupId )
234     {
235         this.groupId = groupId;
236     } //-- void setGroupId( String )
237 
238     /**
239      * Set properties that will be used during the execution of
240      * addition goals after the creation of the project.
241      * 
242      * @param properties a properties object.
243      */
244     public void setProperties( java.util.Properties properties )
245     {
246         this.properties = properties;
247     } //-- void setProperties( java.util.Properties )
248 
249     /**
250      * Set the URL of the repository where to find the archetype.
251      *            When omitted, the archetype is searched for in
252      * the repository where the catalog comes from.
253      * 
254      * @param repository a repository object.
255      */
256     public void setRepository( String repository )
257     {
258         this.repository = repository;
259     } //-- void setRepository( String )
260 
261     /**
262      * Set the version of the archetype. <code>RELEASE</code> is a
263      * valid version.
264      * 
265      * @param version a version object.
266      */
267     public void setVersion( String version )
268     {
269         this.version = version;
270     } //-- void setVersion( String )
271 
272     
273     public String toString()
274     {
275         return "[" + groupId + ":" + artifactId + ":" + version + ( repository != null ? " -> " + repository : "" ) + "]";
276     }
277     public int hashCode()
278     {
279         return groupId.hashCode() + 17 * artifactId.hashCode();
280     }
281     public boolean equals( Object object )
282     {
283         if ( object == null || !( object instanceof Archetype ) )
284         {
285             return false;
286         }
287         else
288         {
289             Archetype a = (Archetype) object;
290             return org.codehaus.plexus.util.StringUtils.equals( groupId, a.getGroupId() )
291                    && org.codehaus.plexus.util.StringUtils.equals( artifactId, a.getArtifactId() );
292         }
293     }
294           
295 }