001 // =================== DO NOT EDIT THIS FILE ====================
002 // Generated by Modello 1.7,
003 // any modifications will be overwritten.
004 // ==============================================================
005
006 package org.apache.maven.model;
007
008 /**
009 * Describes a build extension to utilise.
010 *
011 * @version $Revision$ $Date$
012 */
013 @SuppressWarnings( "all" )
014 public class Extension
015 implements java.io.Serializable, java.lang.Cloneable, org.apache.maven.model.InputLocationTracker
016 {
017
018 //--------------------------/
019 //- Class/Member Variables -/
020 //--------------------------/
021
022 /**
023 * The group ID of the extension's artifact.
024 */
025 private String groupId;
026
027 /**
028 * The artifact ID of the extension.
029 */
030 private String artifactId;
031
032 /**
033 * The version of the extension.
034 */
035 private String version;
036
037 /**
038 * Field locations.
039 */
040 private java.util.Map<Object, InputLocation> locations;
041
042
043 //-----------/
044 //- Methods -/
045 //-----------/
046
047 /**
048 * Method clone.
049 *
050 * @return Extension
051 */
052 public Extension clone()
053 {
054 try
055 {
056 Extension copy = (Extension) super.clone();
057
058 if ( copy.locations != null )
059 {
060 copy.locations = new java.util.LinkedHashMap( copy.locations );
061 }
062
063 return copy;
064 }
065 catch ( java.lang.Exception ex )
066 {
067 throw (java.lang.RuntimeException) new java.lang.UnsupportedOperationException( getClass().getName()
068 + " does not support clone()" ).initCause( ex );
069 }
070 } //-- Extension clone()
071
072 /**
073 * Get the artifact ID of the extension.
074 *
075 * @return String
076 */
077 public String getArtifactId()
078 {
079 return this.artifactId;
080 } //-- String getArtifactId()
081
082 /**
083 * Get the group ID of the extension's artifact.
084 *
085 * @return String
086 */
087 public String getGroupId()
088 {
089 return this.groupId;
090 } //-- String getGroupId()
091
092 /**
093 *
094 *
095 * @param key
096 * @return InputLocation
097 */
098 public InputLocation getLocation( Object key )
099 {
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 }