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