1
2
3
4
5
6
7
8
9 package org.jomc.modlet;
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79 @XmlAccessorType(XmlAccessType.FIELD)
80 @XmlType(name = "Property", namespace = "http://jomc.org/modlet", propOrder = {
81 "any"
82 })
83 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-01-04T08:47:18+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
84 public class Property
85 extends ModletObject
86 implements Cloneable
87 {
88
89 @XmlAnyElement(lax = true)
90 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-01-04T08:47:18+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
91 protected List<Object> any;
92 @XmlAttribute(name = "name", required = true)
93 @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
94 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-01-04T08:47:18+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
95 protected String name;
96 @XmlAttribute(name = "value")
97 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-01-04T08:47:18+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
98 protected String value;
99
100
101
102
103
104 public Property() {
105
106 super();
107 }
108
109
110
111
112
113
114
115
116
117
118 public Property(final Property o) {
119
120 super(o);
121 if (o == null) {
122 throw new NullPointerException("Cannot create a copy of 'Property' from 'null'.");
123 }
124
125 if (o.any!= null) {
126 copyAny(o.getAny(), this.getAny());
127 }
128
129 this.name = ((o.name == null)?null:o.getName());
130
131 this.value = ((o.value == null)?null:o.getValue());
132 }
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-01-04T08:47:18+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
158 public List<Object> getAny() {
159 if (any == null) {
160 any = new ArrayList<Object>();
161 }
162 return this.any;
163 }
164
165
166
167
168
169
170
171
172
173 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-01-04T08:47:18+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
174 public String getName() {
175 return name;
176 }
177
178
179
180
181
182
183
184
185
186 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-01-04T08:47:18+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
187 public void setName(String value) {
188 this.name = value;
189 }
190
191
192
193
194
195
196
197
198
199 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-01-04T08:47:18+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
200 public String getValue() {
201 return value;
202 }
203
204
205
206
207
208
209
210
211
212 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-01-04T08:47:18+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
213 public void setValue(String value) {
214 this.value = value;
215 }
216
217
218
219
220
221
222
223
224
225
226
227 @SuppressWarnings("unchecked")
228 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-01-04T08:47:18+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
229 private static void copyAny(final List<Object> source, final List<Object> target) {
230
231 if ((source!= null)&&(!source.isEmpty())) {
232 for (final Iterator<?> it = source.iterator(); it.hasNext(); ) {
233 final Object next = it.next();
234 if (next instanceof Element) {
235
236 target.add(((Element)((Element) next).cloneNode(true)));
237 continue;
238 }
239 if (next instanceof Object) {
240
241 target.add(copyOf(((Object) next)));
242 continue;
243 }
244
245 throw new AssertionError((("Unexpected instance '"+ next)+"' for property 'Any' of class 'org.jomc.modlet.Property'."));
246 }
247 }
248 }
249
250
251
252
253
254
255
256
257
258 @SuppressWarnings("unchecked")
259 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-01-04T08:47:18+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
260 private static Object copyOf(final Object o) {
261
262 try {
263 if (o!= null) {
264 if (o.getClass().isPrimitive()) {
265 return o;
266 }
267 if (o.getClass().isArray()) {
268 return copyOfArray(o);
269 }
270
271 if (o instanceof Boolean) {
272 return o;
273 }
274 if (o instanceof Byte) {
275 return o;
276 }
277 if (o instanceof Character) {
278 return o;
279 }
280 if (o instanceof Double) {
281 return o;
282 }
283 if (o instanceof Enum) {
284 return o;
285 }
286 if (o instanceof Float) {
287 return o;
288 }
289 if (o instanceof Integer) {
290 return o;
291 }
292 if (o instanceof Long) {
293 return o;
294 }
295 if (o instanceof Short) {
296 return o;
297 }
298 if (o instanceof String) {
299 return o;
300 }
301 if (o instanceof BigDecimal) {
302 return o;
303 }
304 if (o instanceof BigInteger) {
305 return o;
306 }
307 if (o instanceof UUID) {
308 return o;
309 }
310 if (o instanceof QName) {
311 return o;
312 }
313 if (o instanceof Duration) {
314 return o;
315 }
316 if (o instanceof Currency) {
317 return o;
318 }
319
320 if (o instanceof File) {
321 return new File(o.toString());
322 }
323 if (o instanceof URI) {
324 return new URI(o.toString());
325 }
326 if (o instanceof URL) {
327 return new URL(o.toString());
328 }
329 if (o instanceof MimeType) {
330 return new MimeType(o.toString());
331 }
332
333 if (o instanceof XMLGregorianCalendar) {
334 return ((XMLGregorianCalendar) o).clone();
335 }
336 if (o instanceof Date) {
337 return ((Date) o).clone();
338 }
339 if (o instanceof Calendar) {
340 return ((Calendar) o).clone();
341 }
342 if (o instanceof TimeZone) {
343 return ((TimeZone) o).clone();
344 }
345 if (o instanceof Locale) {
346 return ((Locale) o).clone();
347 }
348 if (o instanceof Element) {
349 return ((Element)((Element) o).cloneNode(true));
350 }
351 if (o instanceof JAXBElement) {
352 return copyOf(((JAXBElement) o));
353 }
354 try {
355 return o.getClass().getMethod("clone", ((Class[]) null)).invoke(o, ((Object[]) null));
356 } catch (NoSuchMethodException e) {
357 if (o instanceof Serializable) {
358 return copyOf(((Serializable) o));
359 }
360
361 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
362 } catch (IllegalAccessException e) {
363
364 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
365 } catch (InvocationTargetException e) {
366
367 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
368 } catch (SecurityException e) {
369
370 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
371 } catch (IllegalArgumentException e) {
372
373 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
374 } catch (ExceptionInInitializerError e) {
375
376 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
377 }
378 }
379 return null;
380 } catch (MalformedURLException e) {
381 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
382 } catch (URISyntaxException e) {
383 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
384 } catch (MimeTypeParseException e) {
385 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
386 }
387 }
388
389
390
391
392
393
394
395
396
397 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-01-04T08:47:18+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
398 private static Object copyOfArray(final Object array) {
399
400 if (array!= null) {
401 if (array.getClass() == boolean[].class) {
402 return copyOf(((boolean[]) array));
403 }
404 if (array.getClass() == byte[].class) {
405 return copyOf(((byte[]) array));
406 }
407 if (array.getClass() == char[].class) {
408 return copyOf(((char[]) array));
409 }
410 if (array.getClass() == double[].class) {
411 return copyOf(((double[]) array));
412 }
413 if (array.getClass() == float[].class) {
414 return copyOf(((float[]) array));
415 }
416 if (array.getClass() == int[].class) {
417 return copyOf(((int[]) array));
418 }
419 if (array.getClass() == long[].class) {
420 return copyOf(((long[]) array));
421 }
422 if (array.getClass() == short[].class) {
423 return copyOf(((short[]) array));
424 }
425 final int len = Array.getLength(array);
426 final Object copy = Array.newInstance(array.getClass().getComponentType(), len);
427 for (int i = (len- 1); (i >= 0); i--) {
428 Array.set(copy, i, copyOf(Array.get(array, i)));
429 }
430 return copy;
431 }
432 return null;
433 }
434
435
436
437
438
439
440
441
442
443 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-01-04T08:47:18+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
444 private static boolean[] copyOf(final boolean[] array) {
445
446 if (array!= null) {
447 final boolean[] copy = ((boolean[]) Array.newInstance(array.getClass().getComponentType(), array.length));
448 System.arraycopy(array, 0, copy, 0, array.length);
449 return copy;
450 }
451 return null;
452 }
453
454
455
456
457
458
459
460
461
462 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-01-04T08:47:18+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
463 private static byte[] copyOf(final byte[] array) {
464
465 if (array!= null) {
466 final byte[] copy = ((byte[]) Array.newInstance(array.getClass().getComponentType(), array.length));
467 System.arraycopy(array, 0, copy, 0, array.length);
468 return copy;
469 }
470 return null;
471 }
472
473
474
475
476
477
478
479
480
481 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-01-04T08:47:18+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
482 private static char[] copyOf(final char[] array) {
483
484 if (array!= null) {
485 final char[] copy = ((char[]) Array.newInstance(array.getClass().getComponentType(), array.length));
486 System.arraycopy(array, 0, copy, 0, array.length);
487 return copy;
488 }
489 return null;
490 }
491
492
493
494
495
496
497
498
499
500 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-01-04T08:47:18+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
501 private static double[] copyOf(final double[] array) {
502
503 if (array!= null) {
504 final double[] copy = ((double[]) Array.newInstance(array.getClass().getComponentType(), array.length));
505 System.arraycopy(array, 0, copy, 0, array.length);
506 return copy;
507 }
508 return null;
509 }
510
511
512
513
514
515
516
517
518
519 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-01-04T08:47:18+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
520 private static float[] copyOf(final float[] array) {
521
522 if (array!= null) {
523 final float[] copy = ((float[]) Array.newInstance(array.getClass().getComponentType(), array.length));
524 System.arraycopy(array, 0, copy, 0, array.length);
525 return copy;
526 }
527 return null;
528 }
529
530
531
532
533
534
535
536
537
538 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-01-04T08:47:18+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
539 private static int[] copyOf(final int[] array) {
540
541 if (array!= null) {
542 final int[] copy = ((int[]) Array.newInstance(array.getClass().getComponentType(), array.length));
543 System.arraycopy(array, 0, copy, 0, array.length);
544 return copy;
545 }
546 return null;
547 }
548
549
550
551
552
553
554
555
556
557 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-01-04T08:47:18+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
558 private static long[] copyOf(final long[] array) {
559
560 if (array!= null) {
561 final long[] copy = ((long[]) Array.newInstance(array.getClass().getComponentType(), array.length));
562 System.arraycopy(array, 0, copy, 0, array.length);
563 return copy;
564 }
565 return null;
566 }
567
568
569
570
571
572
573
574
575
576 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-01-04T08:47:18+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
577 private static short[] copyOf(final short[] array) {
578
579 if (array!= null) {
580 final short[] copy = ((short[]) Array.newInstance(array.getClass().getComponentType(), array.length));
581 System.arraycopy(array, 0, copy, 0, array.length);
582 return copy;
583 }
584 return null;
585 }
586
587
588
589
590
591
592
593
594
595 @SuppressWarnings("unchecked")
596 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-01-04T08:47:18+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
597 private static JAXBElement copyOf(final JAXBElement element) {
598
599 if (element!= null) {
600 final JAXBElement copy = new JAXBElement(element.getName(), element.getDeclaredType(), element.getScope(), element.getValue());
601 copy.setNil(element.isNil());
602 copy.setValue(copyOf(copy.getValue()));
603 return copy;
604 }
605 return null;
606 }
607
608
609
610
611
612
613
614
615
616 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-01-04T08:47:18+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
617 private static Serializable copyOf(final Serializable serializable) {
618
619 if (serializable!= null) {
620 try {
621 final ByteArrayOutputStream byteArrayOutput = new ByteArrayOutputStream();
622 final ObjectOutputStream out = new ObjectOutputStream(byteArrayOutput);
623 out.writeObject(serializable);
624 out.close();
625 final ByteArrayInputStream byteArrayInput = new ByteArrayInputStream(byteArrayOutput.toByteArray());
626 final ObjectInputStream in = new ObjectInputStream(byteArrayInput);
627 final Serializable copy = ((Serializable) in.readObject());
628 in.close();
629 return copy;
630 } catch (SecurityException e) {
631 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e));
632 } catch (ClassNotFoundException e) {
633 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e));
634 } catch (InvalidClassException e) {
635 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e));
636 } catch (NotSerializableException e) {
637 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e));
638 } catch (StreamCorruptedException e) {
639 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e));
640 } catch (OptionalDataException e) {
641 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e));
642 } catch (IOException e) {
643 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e));
644 }
645 }
646 return null;
647 }
648
649
650
651
652
653
654
655
656 @Override
657 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-01-04T08:47:18+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
658 public Property clone() {
659 {
660
661 final Property clone = ((Property) super.clone());
662
663 if (this.any!= null) {
664 clone.any = null;
665 copyAny(this.getAny(), clone.getAny());
666 }
667
668 clone.name = ((this.name == null)?null:this.getName());
669
670 clone.value = ((this.value == null)?null:this.getValue());
671 return clone;
672 }
673 }
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694 public <T> javax.xml.bind.JAXBElement<T> getAnyElement( final String namespaceURI, final String localPart,
695 final Class<T> type )
696 {
697 return this.getAnyElement( this.getAny(), namespaceURI, localPart, type );
698 }
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718 public <T> java.util.List<javax.xml.bind.JAXBElement<T>> getAnyElements( final String namespaceURI,
719 final String localPart,
720 final Class<T> type )
721 {
722 return this.getAnyElements( this.getAny(), namespaceURI, localPart, type );
723 }
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739 public <T> T getAnyObject( final Class<T> clazz )
740 {
741 return this.getAnyObject( this.getAny(), clazz );
742 }
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757 public <T> java.util.List<T> getAnyObjects( final Class<T> clazz )
758 {
759 return this.getAnyObjects( this.getAny(), clazz );
760 }
761
762 }