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