View Javadoc

1   // =================== DO NOT EDIT THIS FILE ====================
2   // Generated by Modello 1.7,
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        //-----------/
44       //- Methods -/
45      //-----------/
46  
47      /**
48       * Method clone.
49       * 
50       * @return Extension
51       */
52      public Extension clone()
53      {
54          try
55          {
56              Extension copy = (Extension) super.clone();
57  
58              if ( copy.locations != null )
59              {
60                  copy.locations = new java.util.LinkedHashMap( copy.locations );
61              }
62  
63              return copy;
64          }
65          catch ( java.lang.Exception ex )
66          {
67              throw (java.lang.RuntimeException) new java.lang.UnsupportedOperationException( getClass().getName()
68                  + " does not support clone()" ).initCause( ex );
69          }
70      } //-- Extension clone()
71  
72      /**
73       * Get the artifact ID of the extension.
74       * 
75       * @return String
76       */
77      public String getArtifactId()
78      {
79          return this.artifactId;
80      } //-- String getArtifactId()
81  
82      /**
83       * Get the group ID of the extension's artifact.
84       * 
85       * @return String
86       */
87      public String getGroupId()
88      {
89          return this.groupId;
90      } //-- String getGroupId()
91  
92      /**
93       * 
94       * 
95       * @param key
96       * @return InputLocation
97       */
98      public InputLocation getLocation( Object key )
99      {
100         return ( locations != null ) ? locations.get( key ) : null;
101     } //-- InputLocation getLocation( Object )
102 
103     /**
104      * Get the version of the extension.
105      * 
106      * @return String
107      */
108     public String getVersion()
109     {
110         return this.version;
111     } //-- String getVersion()
112 
113     /**
114      * Set the artifact ID of the extension.
115      * 
116      * @param artifactId
117      */
118     public void setArtifactId( String artifactId )
119     {
120         this.artifactId = artifactId;
121     } //-- void setArtifactId( String )
122 
123     /**
124      * Set the group ID of the extension's artifact.
125      * 
126      * @param groupId
127      */
128     public void setGroupId( String groupId )
129     {
130         this.groupId = groupId;
131     } //-- void setGroupId( String )
132 
133     /**
134      * 
135      * 
136      * @param key
137      * @param location
138      */
139     public void setLocation( Object key, InputLocation location )
140     {
141         if ( location != null )
142         {
143             if ( this.locations == null )
144             {
145                 this.locations = new java.util.LinkedHashMap<Object, InputLocation>();
146             }
147             this.locations.put( key, location );
148         }
149     } //-- void setLocation( Object, InputLocation )
150 
151     /**
152      * Set the version of the extension.
153      * 
154      * @param version
155      */
156     public void setVersion( String version )
157     {
158         this.version = version;
159     } //-- void setVersion( String )
160 
161     
162             
163     /**
164      * @see java.lang.Object#equals(java.lang.Object)
165      */
166     public boolean equals( Object o )
167     {
168         if ( this == o )
169         {
170             return true;
171         }
172 
173         if ( !( o instanceof Extension ) )
174         {
175             return false;
176         }
177 
178         Extension e = (Extension) o;
179 
180         if ( !equal( e.getArtifactId(), getArtifactId() ) )
181         {
182             return false;
183         }
184         else if ( !equal( e.getGroupId(), getGroupId() ) )
185         {
186             return false;
187         }
188         else if ( !equal( e.getVersion(), getVersion() ) )
189         {
190             return false;
191         }
192         return true;
193     }
194 
195     private static <T> boolean equal( T obj1, T obj2 )
196     {
197         return ( obj1 != null ) ? obj1.equals( obj2 ) : obj2 == null;
198     }
199 
200     /**
201      * @see java.lang.Object#hashCode()
202      */
203     public int hashCode()
204     {
205         int result = 17;
206         result = 37 * result + ( getArtifactId() != null ? getArtifactId().hashCode() : 0 );
207         result = 37 * result + ( getGroupId() != null ? getGroupId().hashCode() : 0 );
208         result = 37 * result + ( getVersion() != null ? getVersion().hashCode() : 0 );
209         return result;
210     }
211             
212           
213 }