1 | // |
2 | // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 |
3 | // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> |
4 | // Any modifications to this file will be lost upon recompilation of the source schema. |
5 | // Generated on: 2010.02.03 at 01:25:12 AM UTC |
6 | // |
7 | |
8 | |
9 | package org.jomc.model; |
10 | |
11 | import java.util.ArrayList; |
12 | import java.util.Iterator; |
13 | import java.util.List; |
14 | import javax.annotation.Generated; |
15 | import javax.xml.bind.annotation.XmlAccessType; |
16 | import javax.xml.bind.annotation.XmlAccessorType; |
17 | import javax.xml.bind.annotation.XmlType; |
18 | |
19 | |
20 | /** |
21 | * List of implementations. |
22 | * |
23 | * <p>Java class for Implementations complex type. |
24 | * |
25 | * <p>The following schema fragment specifies the expected content contained within this class. |
26 | * |
27 | * <pre> |
28 | * <complexType name="Implementations"> |
29 | * <complexContent> |
30 | * <extension base="{http://jomc.org/model}ModelObject"> |
31 | * <sequence> |
32 | * <element ref="{http://jomc.org/model}implementation" maxOccurs="unbounded" minOccurs="0"/> |
33 | * <element name="reference" type="{http://jomc.org/model}ImplementationReference" maxOccurs="unbounded" minOccurs="0"/> |
34 | * </sequence> |
35 | * </extension> |
36 | * </complexContent> |
37 | * </complexType> |
38 | * </pre> |
39 | * |
40 | * |
41 | */ |
42 | @XmlAccessorType(XmlAccessType.FIELD) |
43 | @XmlType(name = "Implementations", propOrder = { |
44 | "implementation", |
45 | "reference" |
46 | }) |
47 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-02-03T01:25:12+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833") |
48 | public class Implementations |
49 | extends ModelObject |
50 | implements Cloneable |
51 | { |
52 | |
53 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-02-03T01:25:12+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833") |
54 | protected List<Implementation> implementation; |
55 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-02-03T01:25:12+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833") |
56 | protected List<ImplementationReference> reference; |
57 | |
58 | /** |
59 | * Creates a new {@code Implementations} instance. |
60 | * |
61 | */ |
62 | public Implementations() { |
63 | // CC-XJC Version 1.2 Build 2009-11-15T21:50:02+0000 |
64 | super(); |
65 | } |
66 | |
67 | /** |
68 | * Creates a new {@code Implementations} instance by deeply copying a given {@code Implementations} instance. |
69 | * |
70 | * |
71 | * @param o |
72 | * The instance to copy. |
73 | * @throws NullPointerException |
74 | * if {@code o} is {@code null}. |
75 | */ |
76 | public Implementations(final Implementations o) { |
77 | // CC-XJC Version 1.2 Build 2009-11-15T21:50:02+0000 |
78 | super(o); |
79 | if (o == null) { |
80 | throw new NullPointerException("Cannot create a copy of 'Implementations' from 'null'."); |
81 | } |
82 | // 'Implementation' collection. |
83 | copyImplementation(o.getImplementation(), getImplementation()); |
84 | // 'Reference' collection. |
85 | copyReference(o.getReference(), getReference()); |
86 | } |
87 | |
88 | /** |
89 | * Gets the value of the implementation property. |
90 | * |
91 | * <p> |
92 | * This accessor method returns a reference to the live list, |
93 | * not a snapshot. Therefore any modification you make to the |
94 | * returned list will be present inside the JAXB object. |
95 | * This is why there is not a <CODE>set</CODE> method for the implementation property. |
96 | * |
97 | * <p> |
98 | * For example, to add a new item, do as follows: |
99 | * <pre> |
100 | * getImplementation().add(newItem); |
101 | * </pre> |
102 | * |
103 | * |
104 | * <p> |
105 | * Objects of the following type(s) are allowed in the list |
106 | * {@link Implementation } |
107 | * |
108 | * |
109 | */ |
110 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-02-03T01:25:12+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833") |
111 | public List<Implementation> getImplementation() { |
112 | if (implementation == null) { |
113 | implementation = new ArrayList<Implementation>(); |
114 | } |
115 | return this.implementation; |
116 | } |
117 | |
118 | /** |
119 | * Gets the value of the reference property. |
120 | * |
121 | * <p> |
122 | * This accessor method returns a reference to the live list, |
123 | * not a snapshot. Therefore any modification you make to the |
124 | * returned list will be present inside the JAXB object. |
125 | * This is why there is not a <CODE>set</CODE> method for the reference property. |
126 | * |
127 | * <p> |
128 | * For example, to add a new item, do as follows: |
129 | * <pre> |
130 | * getReference().add(newItem); |
131 | * </pre> |
132 | * |
133 | * |
134 | * <p> |
135 | * Objects of the following type(s) are allowed in the list |
136 | * {@link ImplementationReference } |
137 | * |
138 | * |
139 | */ |
140 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-02-03T01:25:12+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833") |
141 | public List<ImplementationReference> getReference() { |
142 | if (reference == null) { |
143 | reference = new ArrayList<ImplementationReference>(); |
144 | } |
145 | return this.reference; |
146 | } |
147 | |
148 | /** |
149 | * Copies all values of property {@code Implementation} deeply. |
150 | * |
151 | * @param target |
152 | * The target to copy {@code source} to. |
153 | * @param source |
154 | * The source to copy from. |
155 | * @throws NullPointerException |
156 | * if {@code source} or {@code target} is {@code null}. |
157 | */ |
158 | @SuppressWarnings("unchecked") |
159 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-02-03T01:25:12+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833") |
160 | private static void copyImplementation(final List<Implementation> source, final List<Implementation> target) { |
161 | // CC-XJC Version 1.2 Build 2009-11-15T21:50:02+0000 |
162 | if (!source.isEmpty()) { |
163 | for (Iterator it = source.iterator(); it.hasNext(); ) { |
164 | final Object next = it.next(); |
165 | if (next instanceof Implementation) { |
166 | // CClassInfo: org.jomc.model.Implementation |
167 | target.add(((Implementation) next).clone()); |
168 | continue; |
169 | } |
170 | // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/ |
171 | throw new AssertionError((("Unexpected instance '"+ next)+"' for property 'Implementation' of class 'org.jomc.model.Implementations'.")); |
172 | } |
173 | } |
174 | } |
175 | |
176 | /** |
177 | * Copies all values of property {@code Reference} deeply. |
178 | * |
179 | * @param target |
180 | * The target to copy {@code source} to. |
181 | * @param source |
182 | * The source to copy from. |
183 | * @throws NullPointerException |
184 | * if {@code source} or {@code target} is {@code null}. |
185 | */ |
186 | @SuppressWarnings("unchecked") |
187 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-02-03T01:25:12+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833") |
188 | private static void copyReference(final List<ImplementationReference> source, final List<ImplementationReference> target) { |
189 | // CC-XJC Version 1.2 Build 2009-11-15T21:50:02+0000 |
190 | if (!source.isEmpty()) { |
191 | for (Iterator it = source.iterator(); it.hasNext(); ) { |
192 | final Object next = it.next(); |
193 | if (next instanceof ImplementationReference) { |
194 | // CClassInfo: org.jomc.model.ImplementationReference |
195 | target.add(((ImplementationReference) next).clone()); |
196 | continue; |
197 | } |
198 | // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/ |
199 | throw new AssertionError((("Unexpected instance '"+ next)+"' for property 'Reference' of class 'org.jomc.model.Implementations'.")); |
200 | } |
201 | } |
202 | } |
203 | |
204 | /** |
205 | * Creates and returns a deep copy of this object. |
206 | * |
207 | * |
208 | * @return |
209 | * A deep copy of this object. |
210 | */ |
211 | @Override |
212 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-02-03T01:25:12+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833") |
213 | public Implementations clone() { |
214 | // CC-XJC Version 1.2 Build 2009-11-15T21:50:02+0000 |
215 | return new Implementations(this); |
216 | } |
217 | |
218 | /** |
219 | * Gets an implementation for a given identifier from the list. |
220 | * |
221 | * @param implementation The identifier of the implementation to return. |
222 | * |
223 | * @return The implementation identified by {@code implementation} from the |
224 | * list or {@code null}, if no implementation matching |
225 | * {@code implementation} is found. |
226 | * |
227 | * @throws NullPointerException if {@code implementation} is {@code null}. |
228 | * |
229 | * @see #getImplementation() |
230 | */ |
231 | public Implementation getImplementation( final String implementation ) |
232 | { |
233 | if ( implementation == null ) |
234 | { |
235 | throw new NullPointerException( "implementation" ); |
236 | } |
237 | |
238 | for ( Implementation i : this.getImplementation() ) |
239 | { |
240 | if ( implementation.equals( i.getIdentifier() ) ) |
241 | { |
242 | return i; |
243 | } |
244 | } |
245 | |
246 | return null; |
247 | } |
248 | |
249 | /** |
250 | * Gets an implementation for a given class from the list. |
251 | * |
252 | * @param implementation The class of the implementation to return. |
253 | * |
254 | * @return The implementation identified by {@code implementation} from the |
255 | * list or {@code null}, if no implementation matching |
256 | * {@code implementation} is found. |
257 | * |
258 | * @throws NullPointerException if {@code implementation} is {@code null}. |
259 | * |
260 | * @see #getImplementation() |
261 | */ |
262 | public Implementation getImplementation( final Class implementation ) |
263 | { |
264 | if ( implementation == null ) |
265 | { |
266 | throw new NullPointerException( "implementation" ); |
267 | } |
268 | |
269 | for ( Implementation i : this.getImplementation() ) |
270 | { |
271 | if ( i.isClassDeclaration() && implementation.getName().equals( i.getClazz() ) ) |
272 | { |
273 | return i; |
274 | } |
275 | } |
276 | |
277 | return null; |
278 | } |
279 | |
280 | /** |
281 | * Gets an implementation for a given name from the list. |
282 | * |
283 | * @param name The name of the implementation to return. |
284 | * |
285 | * @return The implementation named {@code name} from the list or |
286 | * {@code null}, if no implementation matching {@code name} is found. |
287 | * |
288 | * @throws NullPointerException if {@code name} is {@code null}. |
289 | * |
290 | * @see #getImplementation() |
291 | */ |
292 | public Implementation getImplementationByName( final String name ) |
293 | { |
294 | if ( name == null ) |
295 | { |
296 | throw new NullPointerException( "name" ); |
297 | } |
298 | |
299 | for ( Implementation i : this.getImplementation() ) |
300 | { |
301 | if ( name.equals( i.getName() ) ) |
302 | { |
303 | return i; |
304 | } |
305 | } |
306 | |
307 | return null; |
308 | } |
309 | |
310 | /** |
311 | * Gets an implementation reference for a given identifier from the list of |
312 | * references. |
313 | * |
314 | * @param implementation The identifier of the reference to return. |
315 | * |
316 | * @return The implementation reference identified by {@code implementation} |
317 | * from the list or {@code null}, if no implementation reference matching |
318 | * {@code implementation} is found. |
319 | * |
320 | * @throws NullPointerException if {@code implementation} is {@code null}. |
321 | * |
322 | * @see #getReference() |
323 | */ |
324 | public ImplementationReference getReference( final String implementation ) |
325 | { |
326 | if ( implementation == null ) |
327 | { |
328 | throw new NullPointerException( "implementation" ); |
329 | } |
330 | |
331 | for ( ImplementationReference r : this.getReference() ) |
332 | { |
333 | if ( implementation.equals( r.getIdentifier() ) ) |
334 | { |
335 | return r; |
336 | } |
337 | } |
338 | |
339 | return null; |
340 | } |
341 | |
342 | |
343 | } |