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    * Describes a build extension to utilise.
10   * 
11   * @version $Revision$ $Date$
12   */
13  @SuppressWarnings( "all" )
14  public class Extension
15      implements java.io.Serializable, java.lang.Cloneable, org.apache.maven.model.InputLocationTracker
16  {
17  
18        //--------------------------/
19       //- Class/Member Variables -/
20      //--------------------------/
21  
22      /**
23       * The group ID of the extension's artifact.
24       */
25      private String groupId;
26  
27      /**
28       * The artifact ID of the extension.
29       */
30      private String artifactId;
31  
32      /**
33       * The version of the extension.
34       */
35      private String version;
36  
37      /**
38       * Field locations.
39       */
40      private java.util.Map<Object, InputLocation> locations;
41  
42      /**
43       * Field location.
44       */
45      private InputLocation location;
46  
47      /**
48       * Field groupIdLocation.
49       */
50      private InputLocation groupIdLocation;
51  
52      /**
53       * Field artifactIdLocation.
54       */
55      private InputLocation artifactIdLocation;
56  
57      /**
58       * Field versionLocation.
59       */
60      private InputLocation versionLocation;
61  
62  
63        //-----------/
64       //- Methods -/
65      //-----------/
66  
67      /**
68       * Method clone.
69       * 
70       * @return Extension
71       */
72      public Extension clone()
73      {
74          try
75          {
76              Extension copy = (Extension) super.clone();
77  
78              if ( copy.locations != null )
79              {
80                  copy.locations = new java.util.LinkedHashMap( copy.locations );
81              }
82  
83              return copy;
84          }
85          catch ( java.lang.Exception ex )
86          {
87              throw (java.lang.RuntimeException) new java.lang.UnsupportedOperationException( getClass().getName()
88                  + " does not support clone()" ).initCause( ex );
89          }
90      } //-- Extension clone()
91  
92      /**
93       * Get the artifact ID of the extension.
94       * 
95       * @return String
96       */
97      public String getArtifactId()
98      {
99          return this.artifactId;
100     } //-- String getArtifactId()
101 
102     /**
103      * Get the group ID of the extension's artifact.
104      * 
105      * @return String
106      */
107     public String getGroupId()
108     {
109         return this.groupId;
110     } //-- String getGroupId()
111 
112     /**
113      * 
114      * 
115      * @param key
116      * @return InputLocation
117      */
118     public InputLocation getLocation( Object key )
119     {
120         if ( key instanceof String )
121         {
122             switch ( ( String ) key )
123             {
124                 case "" :
125                 {
126                     return this.location;
127                 }
128                 case "groupId" :
129                 {
130                     return groupIdLocation;
131                 }
132                 case "artifactId" :
133                 {
134                     return artifactIdLocation;
135                 }
136                 case "version" :
137                 {
138                     return versionLocation;
139                 }
140                 default :
141                 {
142                     return getOtherLocation( key );
143                 }
144                 }
145             }
146             else
147             {
148                 return getOtherLocation( key );
149             }
150     } //-- InputLocation getLocation( Object )
151 
152     /**
153      * 
154      * 
155      * @param key
156      * @param location
157      */
158     public void setLocation( Object key, InputLocation location )
159     {
160         if ( key instanceof String )
161         {
162             switch ( ( String ) key )
163             {
164                 case "" :
165                 {
166                     this.location = location;
167                     return;
168                 }
169                 case "groupId" :
170                 {
171                     groupIdLocation = location;
172                     return;
173                 }
174                 case "artifactId" :
175                 {
176                     artifactIdLocation = location;
177                     return;
178                 }
179                 case "version" :
180                 {
181                     versionLocation = location;
182                     return;
183                 }
184                 default :
185                 {
186                     setOtherLocation( key, location );
187                     return;
188                 }
189                 }
190             }
191             else
192             {
193                 setOtherLocation( key, location );
194             }
195     } //-- void setLocation( Object, InputLocation )
196 
197     /**
198      * 
199      * 
200      * @param key
201      * @param location
202      */
203     public void setOtherLocation( Object key, InputLocation location )
204     {
205         if ( location != null )
206         {
207             if ( this.locations == null )
208             {
209                 this.locations = new java.util.LinkedHashMap<Object, InputLocation>();
210             }
211             this.locations.put( key, location );
212         }
213     } //-- void setOtherLocation( Object, InputLocation )
214 
215     /**
216      * 
217      * 
218      * @param key
219      * @return InputLocation
220      */
221     private InputLocation getOtherLocation( Object key )
222     {
223         return ( locations != null ) ? locations.get( key ) : null;
224     } //-- InputLocation getOtherLocation( Object )
225 
226     /**
227      * Get the version of the extension.
228      * 
229      * @return String
230      */
231     public String getVersion()
232     {
233         return this.version;
234     } //-- String getVersion()
235 
236     /**
237      * Set the artifact ID of the extension.
238      * 
239      * @param artifactId
240      */
241     public void setArtifactId( String artifactId )
242     {
243         this.artifactId = artifactId;
244     } //-- void setArtifactId( String )
245 
246     /**
247      * Set the group ID of the extension's artifact.
248      * 
249      * @param groupId
250      */
251     public void setGroupId( String groupId )
252     {
253         this.groupId = groupId;
254     } //-- void setGroupId( String )
255 
256     /**
257      * Set the version of the extension.
258      * 
259      * @param version
260      */
261     public void setVersion( String version )
262     {
263         this.version = version;
264     } //-- void setVersion( String )
265 
266     
267             
268     /**
269      * @see java.lang.Object#equals(java.lang.Object)
270      */
271     public boolean equals( Object o )
272     {
273         if ( this == o )
274         {
275             return true;
276         }
277 
278         if ( !( o instanceof Extension ) )
279         {
280             return false;
281         }
282 
283         Extension e = (Extension) o;
284 
285         if ( !equal( e.getArtifactId(), getArtifactId() ) )
286         {
287             return false;
288         }
289         else if ( !equal( e.getGroupId(), getGroupId() ) )
290         {
291             return false;
292         }
293         else if ( !equal( e.getVersion(), getVersion() ) )
294         {
295             return false;
296         }
297         return true;
298     }
299 
300     private static <T> boolean equal( T obj1, T obj2 )
301     {
302         return ( obj1 != null ) ? obj1.equals( obj2 ) : obj2 == null;
303     }
304 
305     /**
306      * @see java.lang.Object#hashCode()
307      */
308     public int hashCode()
309     {
310         int result = 17;
311         result = 37 * result + ( getArtifactId() != null ? getArtifactId().hashCode() : 0 );
312         result = 37 * result + ( getGroupId() != null ? getGroupId().hashCode() : 0 );
313         result = 37 * result + ( getVersion() != null ? getVersion().hashCode() : 0 );
314         return result;
315     }
316             
317           
318 }