View Javadoc

1   /*
2    =================== DO NOT EDIT THIS FILE ====================
3    Generated by Modello 1.4.1 on 2012-01-20 18:09:18,
4    any modifications will be overwritten.
5    ==============================================================
6    */
7   
8   package org.apache.maven.model;
9   
10  /**
11   * Describes a build extension to utilise.
12   * 
13   * @version $Revision$ $Date$
14   */
15  @SuppressWarnings( "all" )
16  public class Extension
17      implements java.io.Serializable, java.lang.Cloneable, org.apache.maven.model.InputLocationTracker
18  {
19  
20        //--------------------------/
21       //- Class/Member Variables -/
22      //--------------------------/
23  
24      /**
25       * The group ID of the extension's artifact.
26       */
27      private String groupId;
28  
29      /**
30       * The artifact ID of the extension.
31       */
32      private String artifactId;
33  
34      /**
35       * The version of the extension.
36       */
37      private String version;
38  
39      /**
40       * Field locations.
41       */
42      private java.util.Map<Object, InputLocation> locations;
43  
44  
45        //-----------/
46       //- Methods -/
47      //-----------/
48  
49      /**
50       * Method clone.
51       * 
52       * @return Extension
53       */
54      public Extension clone()
55      {
56          try
57          {
58              Extension copy = (Extension) super.clone();
59  
60              if ( copy.locations != null )
61              {
62                  copy.locations = new java.util.LinkedHashMap( copy.locations );
63              }
64  
65              return copy;
66          }
67          catch ( java.lang.Exception ex )
68          {
69              throw (java.lang.RuntimeException) new java.lang.UnsupportedOperationException( getClass().getName()
70                  + " does not support clone()" ).initCause( ex );
71          }
72      } //-- Extension clone()
73  
74      /**
75       * Get the artifact ID of the extension.
76       * 
77       * @return String
78       */
79      public String getArtifactId()
80      {
81          return this.artifactId;
82      } //-- String getArtifactId()
83  
84      /**
85       * Get the group ID of the extension's artifact.
86       * 
87       * @return String
88       */
89      public String getGroupId()
90      {
91          return this.groupId;
92      } //-- String getGroupId()
93  
94      /**
95       * 
96       * 
97       * @param key
98       * @return InputLocation
99       */
100     public InputLocation getLocation( Object key )
101     {
102         return ( locations != null ) ? locations.get( key ) : null;
103     } //-- InputLocation getLocation( Object )
104 
105     /**
106      * Get the version of the extension.
107      * 
108      * @return String
109      */
110     public String getVersion()
111     {
112         return this.version;
113     } //-- String getVersion()
114 
115     /**
116      * Set the artifact ID of the extension.
117      * 
118      * @param artifactId
119      */
120     public void setArtifactId( String artifactId )
121     {
122         this.artifactId = artifactId;
123     } //-- void setArtifactId( String )
124 
125     /**
126      * Set the group ID of the extension's artifact.
127      * 
128      * @param groupId
129      */
130     public void setGroupId( String groupId )
131     {
132         this.groupId = groupId;
133     } //-- void setGroupId( String )
134 
135     /**
136      * 
137      * 
138      * @param key
139      * @param location
140      */
141     public void setLocation( Object key, InputLocation location )
142     {
143         if ( location != null )
144         {
145             if ( this.locations == null )
146             {
147                 this.locations = new java.util.LinkedHashMap<Object, InputLocation>();
148             }
149             this.locations.put( key, location );
150         }
151     } //-- void setLocation( Object, InputLocation )
152 
153     /**
154      * Set the version of the extension.
155      * 
156      * @param version
157      */
158     public void setVersion( String version )
159     {
160         this.version = version;
161     } //-- void setVersion( String )
162 
163     
164             
165     /**
166      * @see java.lang.Object#equals(java.lang.Object)
167      */
168     public boolean equals( Object o )
169     {
170         if ( this == o )
171         {
172             return true;
173         }
174 
175         if ( !( o instanceof Extension ) )
176         {
177             return false;
178         }
179 
180         Extension e = (Extension) o;
181 
182         if ( !equal( e.getArtifactId(), getArtifactId() ) )
183         {
184             return false;
185         }
186         else if ( !equal( e.getGroupId(), getGroupId() ) )
187         {
188             return false;
189         }
190         else if ( !equal( e.getVersion(), getVersion() ) )
191         {
192             return false;
193         }
194         return true;
195     }
196 
197     private static <T> boolean equal( T obj1, T obj2 )
198     {
199         return ( obj1 != null ) ? obj1.equals( obj2 ) : obj2 == null;
200     }
201 
202     /**
203      * @see java.lang.Object#hashCode()
204      */
205     public int hashCode()
206     {
207         int result = 17;
208         result = 37 * result + ( getArtifactId() != null ? getArtifactId().hashCode() : 0 );
209         result = 37 * result + ( getGroupId() != null ? getGroupId().hashCode() : 0 );
210         result = 37 * result + ( getVersion() != null ? getVersion().hashCode() : 0 );
211         return result;
212     }
213             
214           
215 }