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