1
2
3
4
5
6
7
8 package org.apache.maven.model;
9
10
11
12
13
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
22
23
24
25
26
27 private String groupId;
28
29
30
31
32 private String artifactId;
33
34
35
36
37 private String version;
38
39
40
41
42 private java.util.Map<Object, InputLocation> locations;
43
44
45
46
47
48
49
50
51
52
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 }
73
74
75
76
77
78
79 public String getArtifactId()
80 {
81 return this.artifactId;
82 }
83
84
85
86
87
88
89 public String getGroupId()
90 {
91 return this.groupId;
92 }
93
94
95
96
97
98
99
100 public InputLocation getLocation( Object key )
101 {
102 return ( locations != null ) ? locations.get( key ) : null;
103 }
104
105
106
107
108
109
110 public String getVersion()
111 {
112 return this.version;
113 }
114
115
116
117
118
119
120 public void setArtifactId( String artifactId )
121 {
122 this.artifactId = artifactId;
123 }
124
125
126
127
128
129
130 public void setGroupId( String groupId )
131 {
132 this.groupId = groupId;
133 }
134
135
136
137
138
139
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 }
152
153
154
155
156
157
158 public void setVersion( String version )
159 {
160 this.version = version;
161 }
162
163
164
165
166
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
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 }