1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 package org.apache.maven.model;
25
26
27
28
29
30
31
32
33 @SuppressWarnings( "all" )
34 public class DependencyManagement
35 implements java.io.Serializable, java.lang.Cloneable, org.apache.maven.model.InputLocationTracker
36 {
37
38
39
40
41
42
43
44
45 private java.util.List<Dependency> dependencies;
46
47
48
49
50 private java.util.Map<Object, InputLocation> locations;
51
52
53
54
55 private InputLocation location;
56
57
58
59
60 private InputLocation dependenciesLocation;
61
62
63
64
65
66
67
68
69
70
71
72 public void addDependency( Dependency dependency )
73 {
74 getDependencies().add( dependency );
75 }
76
77
78
79
80
81
82 public DependencyManagement clone()
83 {
84 try
85 {
86 DependencyManagement copy = (DependencyManagement) super.clone();
87
88 if ( this.dependencies != null )
89 {
90 copy.dependencies = new java.util.ArrayList<Dependency>();
91 for ( Dependency item : this.dependencies )
92 {
93 copy.dependencies.add( ( (Dependency) item).clone() );
94 }
95 }
96
97 if ( copy.locations != null )
98 {
99 copy.locations = new java.util.LinkedHashMap( copy.locations );
100 }
101
102 return copy;
103 }
104 catch ( java.lang.Exception ex )
105 {
106 throw (java.lang.RuntimeException) new java.lang.UnsupportedOperationException( getClass().getName()
107 + " does not support clone()" ).initCause( ex );
108 }
109 }
110
111
112
113
114
115
116 public java.util.List<Dependency> getDependencies()
117 {
118 if ( this.dependencies == null )
119 {
120 this.dependencies = new java.util.ArrayList<Dependency>();
121 }
122
123 return this.dependencies;
124 }
125
126
127
128
129
130
131
132 public InputLocation getLocation( Object key )
133 {
134 if ( key instanceof String )
135 {
136 switch ( ( String ) key )
137 {
138 case "" :
139 {
140 return this.location;
141 }
142 case "dependencies" :
143 {
144 return dependenciesLocation;
145 }
146 default :
147 {
148 return getOtherLocation( key );
149 }
150 }
151 }
152 else
153 {
154 return getOtherLocation( key );
155 }
156 }
157
158
159
160
161
162
163
164 public void setLocation( Object key, InputLocation location )
165 {
166 if ( key instanceof String )
167 {
168 switch ( ( String ) key )
169 {
170 case "" :
171 {
172 this.location = location;
173 return;
174 }
175 case "dependencies" :
176 {
177 dependenciesLocation = location;
178 return;
179 }
180 default :
181 {
182 setOtherLocation( key, location );
183 return;
184 }
185 }
186 }
187 else
188 {
189 setOtherLocation( key, location );
190 }
191 }
192
193
194
195
196
197
198
199 public void setOtherLocation( Object key, InputLocation location )
200 {
201 if ( location != null )
202 {
203 if ( this.locations == null )
204 {
205 this.locations = new java.util.LinkedHashMap<Object, InputLocation>();
206 }
207 this.locations.put( key, location );
208 }
209 }
210
211
212
213
214
215
216
217 private InputLocation getOtherLocation( Object key )
218 {
219 return ( locations != null ) ? locations.get( key ) : null;
220 }
221
222
223
224
225
226
227 public void removeDependency( Dependency dependency )
228 {
229 getDependencies().remove( dependency );
230 }
231
232
233
234
235
236
237
238
239
240
241 public void setDependencies( java.util.List<Dependency> dependencies )
242 {
243 this.dependencies = dependencies;
244 }
245
246 }