1
2
3
4
5
6 package org.apache.maven.model;
7
8
9
10
11
12
13 @SuppressWarnings( "all" )
14 public class Extension
15 implements java.io.Serializable, java.lang.Cloneable, org.apache.maven.model.InputLocationTracker
16 {
17
18
19
20
21
22
23
24
25 private String groupId;
26
27
28
29
30 private String artifactId;
31
32
33
34
35 private String version;
36
37
38
39
40 private java.util.Map<Object, InputLocation> locations;
41
42
43
44
45
46
47
48
49
50
51
52 public Extension clone()
53 {
54 try
55 {
56 Extension copy = (Extension) super.clone();
57
58 if ( copy.locations != null )
59 {
60 copy.locations = new java.util.LinkedHashMap( copy.locations );
61 }
62
63 return copy;
64 }
65 catch ( java.lang.Exception ex )
66 {
67 throw (java.lang.RuntimeException) new java.lang.UnsupportedOperationException( getClass().getName()
68 + " does not support clone()" ).initCause( ex );
69 }
70 }
71
72
73
74
75
76
77 public String getArtifactId()
78 {
79 return this.artifactId;
80 }
81
82
83
84
85
86
87 public String getGroupId()
88 {
89 return this.groupId;
90 }
91
92
93
94
95
96
97
98 public InputLocation getLocation( Object key )
99 {
100 return ( locations != null ) ? locations.get( key ) : null;
101 }
102
103
104
105
106
107
108 public String getVersion()
109 {
110 return this.version;
111 }
112
113
114
115
116
117
118 public void setArtifactId( String artifactId )
119 {
120 this.artifactId = artifactId;
121 }
122
123
124
125
126
127
128 public void setGroupId( String groupId )
129 {
130 this.groupId = groupId;
131 }
132
133
134
135
136
137
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 }
150
151
152
153
154
155
156 public void setVersion( String version )
157 {
158 this.version = version;
159 }
160
161
162
163
164
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
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 }