1 /*
2 =================== DO NOT EDIT THIS FILE ====================
3 Generated by Modello 1.0.1 on 2009-09-09 03:30:24,
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 public class Extension
16 implements java.io.Serializable
17 {
18
19 //--------------------------/
20 //- Class/Member Variables -/
21 //--------------------------/
22
23 /**
24 * The group ID of the extension's artifact.
25 */
26 private String groupId;
27
28 /**
29 * The artifact ID of the extension.
30 */
31 private String artifactId;
32
33 /**
34 * The version of the extension.
35 */
36 private String version;
37
38
39 //-----------/
40 //- Methods -/
41 //-----------/
42
43 /**
44 * Get the artifact ID of the extension.
45 *
46 * @return String
47 */
48 public String getArtifactId()
49 {
50 return this.artifactId;
51 } //-- String getArtifactId()
52
53 /**
54 * Get the group ID of the extension's artifact.
55 *
56 * @return String
57 */
58 public String getGroupId()
59 {
60 return this.groupId;
61 } //-- String getGroupId()
62
63 /**
64 * Get the version of the extension.
65 *
66 * @return String
67 */
68 public String getVersion()
69 {
70 return this.version;
71 } //-- String getVersion()
72
73 /**
74 * Set the artifact ID of the extension.
75 *
76 * @param artifactId
77 */
78 public void setArtifactId( String artifactId )
79 {
80 this.artifactId = artifactId;
81 } //-- void setArtifactId( String )
82
83 /**
84 * Set the group ID of the extension's artifact.
85 *
86 * @param groupId
87 */
88 public void setGroupId( String groupId )
89 {
90 this.groupId = groupId;
91 } //-- void setGroupId( String )
92
93 /**
94 * Set the version of the extension.
95 *
96 * @param version
97 */
98 public void setVersion( String version )
99 {
100 this.version = version;
101 } //-- void setVersion( String )
102
103
104
105 /**
106 * Gets the key of the extension. The key is used to merge extensions inherited from a parent with the extensions
107 * of the current project.
108 *
109 * @return The key of the extension, i.e. <code>groupId:artifactId</code>.
110 */
111 public String getKey()
112 {
113 return new StringBuffer( 128 ).append( getGroupId() ).append( ':' ).append( getArtifactId() ).toString();
114 }
115
116 /**
117 * @see java.lang.Object#equals(java.lang.Object)
118 */
119 public boolean equals( Object o )
120 {
121 if ( this == o )
122 {
123 return true;
124 }
125
126 if ( !( o instanceof Extension ) )
127 {
128 return false;
129 }
130
131 Extension e = (Extension) o;
132
133 if ( !equal( e.getArtifactId(), getArtifactId() ) )
134 {
135 return false;
136 }
137 else if ( !equal( e.getGroupId(), getGroupId() ) )
138 {
139 return false;
140 }
141 else if ( !equal( e.getVersion(), getVersion() ) )
142 {
143 return false;
144 }
145 return true;
146 }
147
148 private static <T> boolean equal( T obj1, T obj2 )
149 {
150 return ( obj1 != null ) ? obj1.equals( obj2 ) : obj2 == null;
151 }
152
153 /**
154 * @see java.lang.Object#hashCode()
155 */
156 public int hashCode()
157 {
158 int result = 17;
159 result = 37 * result + ( getArtifactId() != null ? getArtifactId().hashCode() : 0 );
160 result = 37 * result + ( getGroupId() != null ? getGroupId().hashCode() : 0 );
161 result = 37 * result + ( getVersion() != null ? getVersion().hashCode() : 0 );
162 return result;
163 }
164
165
166 }