1 | // |
2 | // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-2 |
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: 2014.02.21 at 04:13:17 AM CET |
6 | // |
7 | |
8 | |
9 | package org.jomc.model; |
10 | |
11 | import java.io.ByteArrayInputStream; |
12 | import java.io.ByteArrayOutputStream; |
13 | import java.io.File; |
14 | import java.io.IOException; |
15 | import java.io.InvalidClassException; |
16 | import java.io.NotSerializableException; |
17 | import java.io.ObjectInputStream; |
18 | import java.io.ObjectOutputStream; |
19 | import java.io.OptionalDataException; |
20 | import java.io.Serializable; |
21 | import java.io.StreamCorruptedException; |
22 | import java.lang.reflect.Array; |
23 | import java.lang.reflect.InvocationTargetException; |
24 | import java.math.BigDecimal; |
25 | import java.math.BigInteger; |
26 | import java.net.MalformedURLException; |
27 | import java.net.URI; |
28 | import java.net.URISyntaxException; |
29 | import java.net.URL; |
30 | import java.util.ArrayList; |
31 | import java.util.Calendar; |
32 | import java.util.Currency; |
33 | import java.util.Date; |
34 | import java.util.Iterator; |
35 | import java.util.List; |
36 | import java.util.Locale; |
37 | import java.util.TimeZone; |
38 | import java.util.UUID; |
39 | import javax.activation.MimeType; |
40 | import javax.activation.MimeTypeParseException; |
41 | import javax.annotation.Generated; |
42 | import javax.xml.bind.JAXBElement; |
43 | import javax.xml.bind.annotation.XmlAccessType; |
44 | import javax.xml.bind.annotation.XmlAccessorType; |
45 | import javax.xml.bind.annotation.XmlAnyElement; |
46 | import javax.xml.bind.annotation.XmlAttribute; |
47 | import javax.xml.bind.annotation.XmlType; |
48 | import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; |
49 | import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; |
50 | import javax.xml.datatype.Duration; |
51 | import javax.xml.datatype.XMLGregorianCalendar; |
52 | import javax.xml.namespace.QName; |
53 | import org.w3c.dom.Element; |
54 | |
55 | |
56 | /** |
57 | * |
58 | * Model of a message argument. |
59 | * |
60 | * The 'Argument' type defines attributes 'index', 'name' and 'type'. Attribute 'index' holds the index of the argument in |
61 | * a list of arguments. Attribute 'name' holds the name uniquely identifying the argument in a set of arguments. Attribute |
62 | * 'type' holds the type of the argument. |
63 | * |
64 | * |
65 | * <p>Java class for Argument complex type. |
66 | * |
67 | * <p>The following schema fragment specifies the expected content contained within this class. |
68 | * |
69 | * <pre> |
70 | * <complexType name="Argument"> |
71 | * <complexContent> |
72 | * <extension base="{http://jomc.org/model}ModelObject"> |
73 | * <sequence> |
74 | * <any processContents='lax' namespace='##other' maxOccurs="unbounded" minOccurs="0"/> |
75 | * </sequence> |
76 | * <attribute name="index" use="required" type="{http://jomc.org/model}Index" /> |
77 | * <attribute name="name" use="required" type="{http://jomc.org/model}Identifier" /> |
78 | * <attribute name="type" type="{http://jomc.org/model}ArgumentType" default="Text" /> |
79 | * </extension> |
80 | * </complexContent> |
81 | * </complexType> |
82 | * </pre> |
83 | * |
84 | * |
85 | */ |
86 | @XmlAccessorType(XmlAccessType.FIELD) |
87 | @XmlType(name = "Argument", namespace = "http://jomc.org/model", propOrder = { |
88 | "any" |
89 | }) |
90 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-21T04:13:17+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
91 | public class Argument |
92 | extends ModelObject |
93 | implements Cloneable |
94 | { |
95 | |
96 | @XmlAnyElement(lax = true) |
97 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-21T04:13:17+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
98 | protected List<Object> any; |
99 | @XmlAttribute(name = "index", required = true) |
100 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-21T04:13:17+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
101 | protected int index; |
102 | @XmlAttribute(name = "name", required = true) |
103 | @XmlJavaTypeAdapter(CollapsedStringAdapter.class) |
104 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-21T04:13:17+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
105 | protected String name; |
106 | @XmlAttribute(name = "type") |
107 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-21T04:13:17+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
108 | protected ArgumentType type; |
109 | |
110 | /** |
111 | * Creates a new {@code Argument} instance. |
112 | * |
113 | */ |
114 | public Argument() { |
115 | // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000 |
116 | super(); |
117 | } |
118 | |
119 | /** |
120 | * Creates a new {@code Argument} instance by deeply copying a given {@code Argument} instance. |
121 | * |
122 | * |
123 | * @param o |
124 | * The instance to copy. |
125 | * @throws NullPointerException |
126 | * if {@code o} is {@code null}. |
127 | */ |
128 | public Argument(final Argument o) { |
129 | // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000 |
130 | super(o); |
131 | if (o == null) { |
132 | throw new NullPointerException("Cannot create a copy of 'Argument' from 'null'."); |
133 | } |
134 | // 'Any' collection. |
135 | if (o.any!= null) { |
136 | copyAny(o.getAny(), this.getAny()); |
137 | } |
138 | // CBuiltinLeafInfo: java.lang.Integer |
139 | this.index = o.getIndex(); |
140 | // CBuiltinLeafInfo: java.lang.String |
141 | this.name = ((o.name == null)?null:o.getName()); |
142 | // CEnumLeafInfo: org.jomc.model.ArgumentType |
143 | this.type = ((o.type == null)?null:o.getType()); |
144 | } |
145 | |
146 | /** |
147 | * Gets the value of the any property. |
148 | * |
149 | * <p> |
150 | * This accessor method returns a reference to the live list, |
151 | * not a snapshot. Therefore any modification you make to the |
152 | * returned list will be present inside the JAXB object. |
153 | * This is why there is not a <CODE>set</CODE> method for the any property. |
154 | * |
155 | * <p> |
156 | * For example, to add a new item, do as follows: |
157 | * <pre> |
158 | * getAny().add(newItem); |
159 | * </pre> |
160 | * |
161 | * |
162 | * <p> |
163 | * Objects of the following type(s) are allowed in the list |
164 | * {@link Element } |
165 | * {@link Object } |
166 | * |
167 | * |
168 | */ |
169 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-21T04:13:17+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
170 | public List<Object> getAny() { |
171 | if (any == null) { |
172 | any = new ArrayList<Object>(); |
173 | } |
174 | return this.any; |
175 | } |
176 | |
177 | /** |
178 | * Index of this argument. |
179 | * |
180 | */ |
181 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-21T04:13:17+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
182 | public int getIndex() { |
183 | return index; |
184 | } |
185 | |
186 | /** |
187 | * Sets the value of the index property. |
188 | * |
189 | */ |
190 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-21T04:13:17+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
191 | public void setIndex(int value) { |
192 | this.index = value; |
193 | } |
194 | |
195 | /** |
196 | * Name of this argument. |
197 | * |
198 | * @return |
199 | * possible object is |
200 | * {@link String } |
201 | * |
202 | */ |
203 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-21T04:13:17+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
204 | public String getName() { |
205 | return name; |
206 | } |
207 | |
208 | /** |
209 | * Sets the value of the name property. |
210 | * |
211 | * @param value |
212 | * allowed object is |
213 | * {@link String } |
214 | * |
215 | */ |
216 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-21T04:13:17+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
217 | public void setName(String value) { |
218 | this.name = value; |
219 | } |
220 | |
221 | /** |
222 | * Type of this argument. |
223 | * |
224 | * @return |
225 | * possible object is |
226 | * {@link ArgumentType } |
227 | * |
228 | */ |
229 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-21T04:13:17+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
230 | public ArgumentType getType() { |
231 | if (type == null) { |
232 | return ArgumentType.TEXT; |
233 | } else { |
234 | return type; |
235 | } |
236 | } |
237 | |
238 | /** |
239 | * Sets the value of the type property. |
240 | * |
241 | * @param value |
242 | * allowed object is |
243 | * {@link ArgumentType } |
244 | * |
245 | */ |
246 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-21T04:13:17+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
247 | public void setType(ArgumentType value) { |
248 | this.type = value; |
249 | } |
250 | |
251 | /** |
252 | * Copies all values of property {@code Any} deeply. |
253 | * |
254 | * @param source |
255 | * The source to copy from. |
256 | * @param target |
257 | * The target to copy {@code source} to. |
258 | * @throws NullPointerException |
259 | * if {@code target} is {@code null}. |
260 | */ |
261 | @SuppressWarnings("unchecked") |
262 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-21T04:13:17+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
263 | private static void copyAny(final List<Object> source, final List<Object> target) { |
264 | // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000 |
265 | if ((source!= null)&&(!source.isEmpty())) { |
266 | for (final Iterator<?> it = source.iterator(); it.hasNext(); ) { |
267 | final Object next = it.next(); |
268 | if (next instanceof Element) { |
269 | // CWildcardTypeInfo: org.w3c.dom.Element |
270 | target.add(((Element)((Element) next).cloneNode(true))); |
271 | continue; |
272 | } |
273 | if (next instanceof Object) { |
274 | // CBuiltinLeafInfo: java.lang.Object |
275 | target.add(copyOf(((Object) next))); |
276 | continue; |
277 | } |
278 | // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/ |
279 | throw new AssertionError((("Unexpected instance '"+ next)+"' for property 'Any' of class 'org.jomc.model.Argument'.")); |
280 | } |
281 | } |
282 | } |
283 | |
284 | /** |
285 | * Creates and returns a deep copy of a given object. |
286 | * |
287 | * @param o |
288 | * The instance to copy or {@code null}. |
289 | * @return |
290 | * A deep copy of {@code o} or {@code null} if {@code o} is {@code null}. |
291 | */ |
292 | @SuppressWarnings("unchecked") |
293 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-21T04:13:17+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
294 | private static Object copyOf(final Object o) { |
295 | // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000 |
296 | try { |
297 | if (o!= null) { |
298 | if (o.getClass().isPrimitive()) { |
299 | return o; |
300 | } |
301 | if (o.getClass().isArray()) { |
302 | return copyOfArray(o); |
303 | } |
304 | // Immutable types. |
305 | if (o instanceof Boolean) { |
306 | return o; |
307 | } |
308 | if (o instanceof Byte) { |
309 | return o; |
310 | } |
311 | if (o instanceof Character) { |
312 | return o; |
313 | } |
314 | if (o instanceof Double) { |
315 | return o; |
316 | } |
317 | if (o instanceof Enum) { |
318 | return o; |
319 | } |
320 | if (o instanceof Float) { |
321 | return o; |
322 | } |
323 | if (o instanceof Integer) { |
324 | return o; |
325 | } |
326 | if (o instanceof Long) { |
327 | return o; |
328 | } |
329 | if (o instanceof Short) { |
330 | return o; |
331 | } |
332 | if (o instanceof String) { |
333 | return o; |
334 | } |
335 | if (o instanceof BigDecimal) { |
336 | return o; |
337 | } |
338 | if (o instanceof BigInteger) { |
339 | return o; |
340 | } |
341 | if (o instanceof UUID) { |
342 | return o; |
343 | } |
344 | if (o instanceof QName) { |
345 | return o; |
346 | } |
347 | if (o instanceof Duration) { |
348 | return o; |
349 | } |
350 | if (o instanceof Currency) { |
351 | return o; |
352 | } |
353 | // String based types. |
354 | if (o instanceof File) { |
355 | return new File(o.toString()); |
356 | } |
357 | if (o instanceof URI) { |
358 | return new URI(o.toString()); |
359 | } |
360 | if (o instanceof URL) { |
361 | return new URL(o.toString()); |
362 | } |
363 | if (o instanceof MimeType) { |
364 | return new MimeType(o.toString()); |
365 | } |
366 | // Cloneable types. |
367 | if (o instanceof XMLGregorianCalendar) { |
368 | return ((XMLGregorianCalendar) o).clone(); |
369 | } |
370 | if (o instanceof Date) { |
371 | return ((Date) o).clone(); |
372 | } |
373 | if (o instanceof Calendar) { |
374 | return ((Calendar) o).clone(); |
375 | } |
376 | if (o instanceof TimeZone) { |
377 | return ((TimeZone) o).clone(); |
378 | } |
379 | if (o instanceof Locale) { |
380 | return ((Locale) o).clone(); |
381 | } |
382 | if (o instanceof Element) { |
383 | return ((Element)((Element) o).cloneNode(true)); |
384 | } |
385 | if (o instanceof JAXBElement) { |
386 | return copyOf(((JAXBElement) o)); |
387 | } |
388 | try { |
389 | return o.getClass().getMethod("clone", ((Class[]) null)).invoke(o, ((Object[]) null)); |
390 | } catch (NoSuchMethodException e) { |
391 | if (o instanceof Serializable) { |
392 | return copyOf(((Serializable) o)); |
393 | } |
394 | // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/ |
395 | throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e)); |
396 | } catch (IllegalAccessException e) { |
397 | // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/ |
398 | throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e)); |
399 | } catch (InvocationTargetException e) { |
400 | // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/ |
401 | throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e)); |
402 | } catch (SecurityException e) { |
403 | // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/ |
404 | throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e)); |
405 | } catch (IllegalArgumentException e) { |
406 | // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/ |
407 | throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e)); |
408 | } catch (ExceptionInInitializerError e) { |
409 | // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/ |
410 | throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e)); |
411 | } |
412 | } |
413 | return null; |
414 | } catch (MimeTypeParseException e) { |
415 | throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e)); |
416 | } catch (MalformedURLException e) { |
417 | throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e)); |
418 | } catch (URISyntaxException e) { |
419 | throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e)); |
420 | } |
421 | } |
422 | |
423 | /** |
424 | * Creates and returns a deep copy of a given array. |
425 | * |
426 | * @param array |
427 | * The array to copy or {@code null}. |
428 | * @return |
429 | * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}. |
430 | */ |
431 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-21T04:13:17+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
432 | private static Object copyOfArray(final Object array) { |
433 | // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000 |
434 | if (array!= null) { |
435 | if (array.getClass() == boolean[].class) { |
436 | return copyOf(((boolean[]) array)); |
437 | } |
438 | if (array.getClass() == byte[].class) { |
439 | return copyOf(((byte[]) array)); |
440 | } |
441 | if (array.getClass() == char[].class) { |
442 | return copyOf(((char[]) array)); |
443 | } |
444 | if (array.getClass() == double[].class) { |
445 | return copyOf(((double[]) array)); |
446 | } |
447 | if (array.getClass() == float[].class) { |
448 | return copyOf(((float[]) array)); |
449 | } |
450 | if (array.getClass() == int[].class) { |
451 | return copyOf(((int[]) array)); |
452 | } |
453 | if (array.getClass() == long[].class) { |
454 | return copyOf(((long[]) array)); |
455 | } |
456 | if (array.getClass() == short[].class) { |
457 | return copyOf(((short[]) array)); |
458 | } |
459 | final int len = Array.getLength(array); |
460 | final Object copy = Array.newInstance(array.getClass().getComponentType(), len); |
461 | for (int i = (len- 1); (i >= 0); i--) { |
462 | Array.set(copy, i, copyOf(Array.get(array, i))); |
463 | } |
464 | return copy; |
465 | } |
466 | return null; |
467 | } |
468 | |
469 | /** |
470 | * Creates and returns a deep copy of a given array. |
471 | * |
472 | * @param array |
473 | * The array to copy or {@code null}. |
474 | * @return |
475 | * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}. |
476 | */ |
477 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-21T04:13:17+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
478 | private static boolean[] copyOf(final boolean[] array) { |
479 | // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000 |
480 | if (array!= null) { |
481 | final boolean[] copy = ((boolean[]) Array.newInstance(array.getClass().getComponentType(), array.length)); |
482 | System.arraycopy(array, 0, copy, 0, array.length); |
483 | return copy; |
484 | } |
485 | return null; |
486 | } |
487 | |
488 | /** |
489 | * Creates and returns a deep copy of a given array. |
490 | * |
491 | * @param array |
492 | * The array to copy or {@code null}. |
493 | * @return |
494 | * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}. |
495 | */ |
496 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-21T04:13:17+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
497 | private static byte[] copyOf(final byte[] array) { |
498 | // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000 |
499 | if (array!= null) { |
500 | final byte[] copy = ((byte[]) Array.newInstance(array.getClass().getComponentType(), array.length)); |
501 | System.arraycopy(array, 0, copy, 0, array.length); |
502 | return copy; |
503 | } |
504 | return null; |
505 | } |
506 | |
507 | /** |
508 | * Creates and returns a deep copy of a given array. |
509 | * |
510 | * @param array |
511 | * The array to copy or {@code null}. |
512 | * @return |
513 | * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}. |
514 | */ |
515 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-21T04:13:17+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
516 | private static char[] copyOf(final char[] array) { |
517 | // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000 |
518 | if (array!= null) { |
519 | final char[] copy = ((char[]) Array.newInstance(array.getClass().getComponentType(), array.length)); |
520 | System.arraycopy(array, 0, copy, 0, array.length); |
521 | return copy; |
522 | } |
523 | return null; |
524 | } |
525 | |
526 | /** |
527 | * Creates and returns a deep copy of a given array. |
528 | * |
529 | * @param array |
530 | * The array to copy or {@code null}. |
531 | * @return |
532 | * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}. |
533 | */ |
534 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-21T04:13:17+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
535 | private static double[] copyOf(final double[] array) { |
536 | // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000 |
537 | if (array!= null) { |
538 | final double[] copy = ((double[]) Array.newInstance(array.getClass().getComponentType(), array.length)); |
539 | System.arraycopy(array, 0, copy, 0, array.length); |
540 | return copy; |
541 | } |
542 | return null; |
543 | } |
544 | |
545 | /** |
546 | * Creates and returns a deep copy of a given array. |
547 | * |
548 | * @param array |
549 | * The array to copy or {@code null}. |
550 | * @return |
551 | * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}. |
552 | */ |
553 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-21T04:13:17+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
554 | private static float[] copyOf(final float[] array) { |
555 | // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000 |
556 | if (array!= null) { |
557 | final float[] copy = ((float[]) Array.newInstance(array.getClass().getComponentType(), array.length)); |
558 | System.arraycopy(array, 0, copy, 0, array.length); |
559 | return copy; |
560 | } |
561 | return null; |
562 | } |
563 | |
564 | /** |
565 | * Creates and returns a deep copy of a given array. |
566 | * |
567 | * @param array |
568 | * The array to copy or {@code null}. |
569 | * @return |
570 | * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}. |
571 | */ |
572 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-21T04:13:17+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
573 | private static int[] copyOf(final int[] array) { |
574 | // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000 |
575 | if (array!= null) { |
576 | final int[] copy = ((int[]) Array.newInstance(array.getClass().getComponentType(), array.length)); |
577 | System.arraycopy(array, 0, copy, 0, array.length); |
578 | return copy; |
579 | } |
580 | return null; |
581 | } |
582 | |
583 | /** |
584 | * Creates and returns a deep copy of a given array. |
585 | * |
586 | * @param array |
587 | * The array to copy or {@code null}. |
588 | * @return |
589 | * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}. |
590 | */ |
591 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-21T04:13:17+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
592 | private static long[] copyOf(final long[] array) { |
593 | // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000 |
594 | if (array!= null) { |
595 | final long[] copy = ((long[]) Array.newInstance(array.getClass().getComponentType(), array.length)); |
596 | System.arraycopy(array, 0, copy, 0, array.length); |
597 | return copy; |
598 | } |
599 | return null; |
600 | } |
601 | |
602 | /** |
603 | * Creates and returns a deep copy of a given array. |
604 | * |
605 | * @param array |
606 | * The array to copy or {@code null}. |
607 | * @return |
608 | * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}. |
609 | */ |
610 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-21T04:13:17+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
611 | private static short[] copyOf(final short[] array) { |
612 | // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000 |
613 | if (array!= null) { |
614 | final short[] copy = ((short[]) Array.newInstance(array.getClass().getComponentType(), array.length)); |
615 | System.arraycopy(array, 0, copy, 0, array.length); |
616 | return copy; |
617 | } |
618 | return null; |
619 | } |
620 | |
621 | /** |
622 | * Creates and returns a deep copy of a given {@code JAXBElement} instance. |
623 | * |
624 | * @param element |
625 | * The instance to copy or {@code null}. |
626 | * @return |
627 | * A deep copy of {@code element} or {@code null} if {@code element} is {@code null}. |
628 | */ |
629 | @SuppressWarnings("unchecked") |
630 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-21T04:13:17+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
631 | private static JAXBElement copyOf(final JAXBElement element) { |
632 | // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000 |
633 | if (element!= null) { |
634 | final JAXBElement copy = new JAXBElement(element.getName(), element.getDeclaredType(), element.getScope(), element.getValue()); |
635 | copy.setNil(element.isNil()); |
636 | copy.setValue(copyOf(copy.getValue())); |
637 | return copy; |
638 | } |
639 | return null; |
640 | } |
641 | |
642 | /** |
643 | * Creates and returns a deep copy of a given {@code Serializable}. |
644 | * |
645 | * @param serializable |
646 | * The instance to copy or {@code null}. |
647 | * @return |
648 | * A deep copy of {@code serializable} or {@code null} if {@code serializable} is {@code null}. |
649 | */ |
650 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-21T04:13:17+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
651 | private static Serializable copyOf(final Serializable serializable) { |
652 | // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000 |
653 | if (serializable!= null) { |
654 | try { |
655 | final ByteArrayOutputStream byteArrayOutput = new ByteArrayOutputStream(); |
656 | final ObjectOutputStream out = new ObjectOutputStream(byteArrayOutput); |
657 | out.writeObject(serializable); |
658 | out.close(); |
659 | final ByteArrayInputStream byteArrayInput = new ByteArrayInputStream(byteArrayOutput.toByteArray()); |
660 | final ObjectInputStream in = new ObjectInputStream(byteArrayInput); |
661 | final Serializable copy = ((Serializable) in.readObject()); |
662 | in.close(); |
663 | return copy; |
664 | } catch (SecurityException e) { |
665 | throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e)); |
666 | } catch (ClassNotFoundException e) { |
667 | throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e)); |
668 | } catch (InvalidClassException e) { |
669 | throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e)); |
670 | } catch (NotSerializableException e) { |
671 | throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e)); |
672 | } catch (StreamCorruptedException e) { |
673 | throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e)); |
674 | } catch (OptionalDataException e) { |
675 | throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e)); |
676 | } catch (IOException e) { |
677 | throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e)); |
678 | } |
679 | } |
680 | return null; |
681 | } |
682 | |
683 | /** |
684 | * Creates and returns a deep copy of this object. |
685 | * |
686 | * |
687 | * @return |
688 | * A deep copy of this object. |
689 | */ |
690 | @Override |
691 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-21T04:13:17+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
692 | public Argument clone() { |
693 | { |
694 | // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000 |
695 | final Argument clone = ((Argument) super.clone()); |
696 | // 'Any' collection. |
697 | if (this.any!= null) { |
698 | clone.any = null; |
699 | copyAny(this.getAny(), clone.getAny()); |
700 | } |
701 | // CBuiltinLeafInfo: java.lang.Integer |
702 | clone.index = this.getIndex(); |
703 | // CBuiltinLeafInfo: java.lang.String |
704 | clone.name = ((this.name == null)?null:this.getName()); |
705 | // CEnumLeafInfo: org.jomc.model.ArgumentType |
706 | clone.type = ((this.type == null)?null:this.getType()); |
707 | return clone; |
708 | } |
709 | } |
710 | |
711 | /** |
712 | * Gets the Java type name of the type referenced by the argument. |
713 | * |
714 | * @return The Java type name of the type referenced by the argument or {@code null}, if the argument does not |
715 | * reference a type. |
716 | * |
717 | * @throws ModelObjectException if compiling the name of the referenced type to a {@code JavaTypeName} fails. |
718 | * |
719 | * @since 1.4 |
720 | * |
721 | * @see #getType() |
722 | */ |
723 | public JavaTypeName getJavaTypeName() throws ModelObjectException |
724 | { |
725 | try |
726 | { |
727 | String typeName = "java.lang.String"; |
728 | |
729 | if ( this.getType() == ArgumentType.DATE || this.getType() == ArgumentType.TIME ) |
730 | { |
731 | typeName = "java.util.Date"; |
732 | } |
733 | else if ( this.getType() == ArgumentType.NUMBER ) |
734 | { |
735 | typeName = "java.lang.Number"; |
736 | } |
737 | |
738 | return JavaTypeName.parse( typeName ); |
739 | } |
740 | catch ( final java.text.ParseException e ) |
741 | { |
742 | throw new ModelObjectException( getMessage( "javaTypeNameParseException", this.getType(), getMessage( e ) ), |
743 | e ); |
744 | |
745 | } |
746 | } |
747 | |
748 | /** |
749 | * Gets the Java variable name of the argument. |
750 | * |
751 | * @return The Java variable name of the argument. |
752 | * |
753 | * @throws ModelObjectException if compiling the name of the argument to a {@code JavaIdentifier} fails. |
754 | * |
755 | * @since 1.4 |
756 | * |
757 | * @see #getName() |
758 | */ |
759 | public JavaIdentifier getJavaVariableName() throws ModelObjectException |
760 | { |
761 | try |
762 | { |
763 | return JavaIdentifier.normalize( this.getName() != null ? this.getName() : "", |
764 | JavaIdentifier.NormalizationMode.VARIABLE_NAME_CONVENTION ); |
765 | |
766 | } |
767 | catch ( final java.text.ParseException e ) |
768 | { |
769 | throw new ModelObjectException( getMessage( "javaMethodParameterNameParseException", this.getName(), |
770 | getMessage( e ) ), e ); |
771 | |
772 | } |
773 | } |
774 | |
775 | /** |
776 | * Gets a single {@code JAXBElement} matching a namespace URI and local part from the {@code any} property of the |
777 | * instance. |
778 | * |
779 | * @param namespaceURI The namespace URI of the {@code JAXBElement} to return. |
780 | * @param localPart The local part of the {@code JAXBElement} to return. |
781 | * |
782 | * @return The {@code JAXBElement} matching {@code namespaceURI} and {@code localPart} from the {@code any} property |
783 | * of the instance or {@code null}, if no such element is found. |
784 | * |
785 | * @throws NullPointerException if {@code namespaceURI} or {@code localPart} is {@code null}. |
786 | * @throws IllegalStateException if the {@code any} property contains more than one matching element. |
787 | * |
788 | * @see #getAnyElement(java.util.List, java.lang.String, java.lang.String) |
789 | * |
790 | * @deprecated As of JOMC 1.1, please use method {@link #getAnyElement(java.lang.String, java.lang.String, java.lang.Class)}. |
791 | * This method will be removed in version 2.0. |
792 | */ |
793 | @Deprecated |
794 | public javax.xml.bind.JAXBElement getAnyElement( final String namespaceURI, final String localPart ) |
795 | { |
796 | return this.getAnyElement( this.getAny(), namespaceURI, localPart ); |
797 | } |
798 | |
799 | /** |
800 | * Gets a list containing all {@code JAXBElement}s matching a namespace URI and local part from the {@code any} |
801 | * property of the instance. |
802 | * |
803 | * @param namespaceURI The namespace URI of the {@code JAXBElement}s to return. |
804 | * @param localPart The local part of the {@code JAXBElement}s to return. |
805 | * |
806 | * @return An unmodifiable list of all {@code JAXBElement}s matching {@code namespaceURI} and {@code localPart} from |
807 | * the {@code any} property of the instance - an empty list if no such elements are found. |
808 | * |
809 | * @throws NullPointerException if {@code namespaceURI} or {@code localPart} is {@code null}. |
810 | * |
811 | * @see #getAnyElements(java.util.List, java.lang.String, java.lang.String) |
812 | * |
813 | * @deprecated As of JOMC 1.1, please use method {@link #getAnyElements(java.lang.String, java.lang.String, java.lang.Class)}. |
814 | * This method will be removed in version 2.0. |
815 | */ |
816 | @Deprecated |
817 | public java.util.List<javax.xml.bind.JAXBElement> getAnyElements( final String namespaceURI, |
818 | final String localPart ) |
819 | { |
820 | return this.getAnyElements( this.getAny(), namespaceURI, localPart ); |
821 | } |
822 | |
823 | /** |
824 | * Gets a single {@code JAXBElement} matching a namespace URI and local part from the {@code any} property of the |
825 | * instance. |
826 | * |
827 | * @param namespaceURI The namespace URI of the {@code JAXBElement} to return. |
828 | * @param localPart The local part of the {@code JAXBElement} to return. |
829 | * @param type The class of the type the element is bound to. |
830 | * @param <T> The type the element is bound to. |
831 | * |
832 | * @return The {@code JAXBElement} matching {@code namespaceURI} and {@code localPart} from the {@code any} property |
833 | * of the instance or {@code null}, if no such element is found. |
834 | * |
835 | * @throws NullPointerException if {@code namespaceURI}, {@code localPart} or {@code type} is {@code null}. |
836 | * @throws IllegalStateException if the {@code any} property contains more than one matching element. |
837 | * |
838 | * @see #getAnyElement(java.util.List, java.lang.String, java.lang.String, java.lang.Class) |
839 | * |
840 | * @since 1.1 |
841 | */ |
842 | public <T> javax.xml.bind.JAXBElement<T> getAnyElement( final String namespaceURI, final String localPart, |
843 | final Class<T> type ) |
844 | { |
845 | return this.getAnyElement( this.getAny(), namespaceURI, localPart, type ); |
846 | } |
847 | |
848 | /** |
849 | * Gets a list containing all {@code JAXBElement}s matching a namespace URI and local part from the {@code any} |
850 | * property of the instance. |
851 | * |
852 | * @param namespaceURI The namespace URI of the {@code JAXBElement}s to return. |
853 | * @param localPart The local part of the {@code JAXBElement}s to return. |
854 | * @param type The class of the type the elements are bound to. |
855 | * @param <T> The type the elements are bound to. |
856 | * |
857 | * @return An unmodifiable list of all {@code JAXBElement}s matching {@code namespaceURI} and {@code localPart} from |
858 | * the {@code any} property of the instance - an empty list if no such elements are found. |
859 | * |
860 | * @throws NullPointerException if {@code namespaceURI}, {@code localPart} or {@code type} is {@code null}. |
861 | * |
862 | * @see #getAnyElements(java.util.List, java.lang.String, java.lang.String, java.lang.Class) |
863 | * |
864 | * @since 1.1 |
865 | */ |
866 | public <T> java.util.List<javax.xml.bind.JAXBElement<T>> getAnyElements( final String namespaceURI, |
867 | final String localPart, |
868 | final Class<T> type ) |
869 | { |
870 | return this.getAnyElements( this.getAny(), namespaceURI, localPart, type ); |
871 | } |
872 | |
873 | /** |
874 | * Gets a single object matching a given class from the {@code any} property of the instance. |
875 | * |
876 | * @param clazz The class to return an instance of. |
877 | * @param <T> The type of the object to return. |
878 | * |
879 | * @return The instance of {@code clazz} from the {@code any} property of the instance or {@code null}, if no such |
880 | * instance is found. |
881 | * |
882 | * @throws NullPointerException if {@code clazz} is {@code null}. |
883 | * @throws IllegalStateException if the {@code any} property contains more than one matching object. |
884 | * |
885 | * @see #getAnyObject(java.util.List, java.lang.Class) |
886 | */ |
887 | public <T> T getAnyObject( final Class<T> clazz ) |
888 | { |
889 | return this.getAnyObject( this.getAny(), clazz ); |
890 | } |
891 | |
892 | /** |
893 | * Gets a list containing all objects matching a given class from the {@code any} property of the instance. |
894 | * |
895 | * @param clazz The class to return all instances of. |
896 | * @param <T> The type of the objects to return. |
897 | * |
898 | * @return An unmodifiable list of all instances of {@code clazz} from the {@code any} property of the instance - |
899 | * an empty list if no such objects are found. |
900 | * |
901 | * @throws NullPointerException if {@code clazz} is {@code null}. |
902 | * |
903 | * @see #getAnyObjects(java.util.List, java.lang.Class) |
904 | */ |
905 | public <T> java.util.List<T> getAnyObjects( final Class<T> clazz ) |
906 | { |
907 | return this.getAnyObjects( this.getAny(), clazz ); |
908 | } |
909 | |
910 | private static String getMessage( final Throwable t ) |
911 | { |
912 | return t != null |
913 | ? t.getMessage() != null && t.getMessage().trim().length() > 0 |
914 | ? t.getMessage() |
915 | : getMessage( t.getCause() ) |
916 | : null; |
917 | |
918 | } |
919 | |
920 | private static String getMessage( final String key, final Object... arguments ) |
921 | { |
922 | return java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( |
923 | Argument.class.getName().replace( '.', '/' ), java.util.Locale.getDefault() ). |
924 | getString( key ), arguments ); |
925 | |
926 | } |
927 | |
928 | } |