1
2
3
4
5
6
7
8
9 package org.jomc.model.test;
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.Calendar;
31 import java.util.Currency;
32 import java.util.Date;
33 import java.util.Locale;
34 import java.util.TimeZone;
35 import java.util.UUID;
36 import javax.activation.MimeType;
37 import javax.activation.MimeTypeParseException;
38 import javax.annotation.Generated;
39 import javax.xml.bind.JAXBElement;
40 import javax.xml.bind.annotation.XmlAccessType;
41 import javax.xml.bind.annotation.XmlAccessorType;
42 import javax.xml.bind.annotation.XmlAnyElement;
43 import javax.xml.bind.annotation.XmlAttribute;
44 import javax.xml.bind.annotation.XmlType;
45 import javax.xml.datatype.Duration;
46 import javax.xml.datatype.XMLGregorianCalendar;
47 import javax.xml.namespace.QName;
48 import org.w3c.dom.Element;
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71 @XmlAccessorType(XmlAccessType.FIELD)
72 @XmlType(name = "AnyModelObject", namespace = "http://jomc.org/model/test", propOrder = {
73 "any"
74 })
75 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:19+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
76 public class AnyModelObject implements Cloneable
77 {
78
79 @XmlAnyElement(lax = true)
80 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:19+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
81 protected Object any;
82 @XmlAttribute(name = "valid", required = true)
83 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:19+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
84 protected boolean valid;
85
86
87
88
89
90 public AnyModelObject() {
91
92 super();
93 }
94
95
96
97
98
99
100
101
102
103
104 public AnyModelObject(final AnyModelObject o) {
105
106 super();
107 if (o == null) {
108 throw new NullPointerException("Cannot create a copy of 'AnyModelObject' from 'null'.");
109 }
110
111 this.any = ((o.any == null)?null:copyOfAny(o.getAny()));
112
113 this.valid = o.isValid();
114 }
115
116
117
118
119
120
121
122
123
124
125 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:19+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
126 public Object getAny() {
127 return any;
128 }
129
130
131
132
133
134
135
136
137
138
139 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:19+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
140 public void setAny(Object value) {
141 this.any = value;
142 }
143
144
145
146
147
148 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:19+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
149 public boolean isValid() {
150 return valid;
151 }
152
153
154
155
156
157 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:19+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
158 public void setValid(boolean value) {
159 this.valid = value;
160 }
161
162
163
164
165
166
167
168
169
170 @SuppressWarnings("unchecked")
171 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:19+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
172 private static Object copyOfAny(final Object source) {
173
174 if (source!= null) {
175 if (source instanceof Element) {
176
177 return ((Element)((Element) source).cloneNode(true));
178 }
179 if (source instanceof Object) {
180
181 return copyOf(((Object) source));
182 }
183
184 throw new AssertionError((("Unexpected instance '"+ source)+"' for property 'Any' of class 'org.jomc.model.test.AnyModelObject'."));
185 }
186 return null;
187 }
188
189
190
191
192
193
194
195
196
197 @SuppressWarnings("unchecked")
198 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:19+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
199 private static Object copyOf(final Object o) {
200
201 try {
202 if (o!= null) {
203 if (o.getClass().isPrimitive()) {
204 return o;
205 }
206 if (o.getClass().isArray()) {
207 return copyOfArray(o);
208 }
209
210 if (o instanceof Boolean) {
211 return o;
212 }
213 if (o instanceof Byte) {
214 return o;
215 }
216 if (o instanceof Character) {
217 return o;
218 }
219 if (o instanceof Double) {
220 return o;
221 }
222 if (o instanceof Enum) {
223 return o;
224 }
225 if (o instanceof Float) {
226 return o;
227 }
228 if (o instanceof Integer) {
229 return o;
230 }
231 if (o instanceof Long) {
232 return o;
233 }
234 if (o instanceof Short) {
235 return o;
236 }
237 if (o instanceof String) {
238 return o;
239 }
240 if (o instanceof BigDecimal) {
241 return o;
242 }
243 if (o instanceof BigInteger) {
244 return o;
245 }
246 if (o instanceof UUID) {
247 return o;
248 }
249 if (o instanceof QName) {
250 return o;
251 }
252 if (o instanceof Duration) {
253 return o;
254 }
255 if (o instanceof Currency) {
256 return o;
257 }
258
259 if (o instanceof File) {
260 return new File(o.toString());
261 }
262 if (o instanceof URI) {
263 return new URI(o.toString());
264 }
265 if (o instanceof URL) {
266 return new URL(o.toString());
267 }
268 if (o instanceof MimeType) {
269 return new MimeType(o.toString());
270 }
271
272 if (o instanceof XMLGregorianCalendar) {
273 return ((XMLGregorianCalendar) o).clone();
274 }
275 if (o instanceof Date) {
276 return ((Date) o).clone();
277 }
278 if (o instanceof Calendar) {
279 return ((Calendar) o).clone();
280 }
281 if (o instanceof TimeZone) {
282 return ((TimeZone) o).clone();
283 }
284 if (o instanceof Locale) {
285 return ((Locale) o).clone();
286 }
287 if (o instanceof Element) {
288 return ((Element)((Element) o).cloneNode(true));
289 }
290 if (o instanceof JAXBElement) {
291 return copyOf(((JAXBElement) o));
292 }
293 try {
294 return o.getClass().getMethod("clone", ((Class[]) null)).invoke(o, ((Object[]) null));
295 } catch (NoSuchMethodException e) {
296 if (o instanceof Serializable) {
297 return copyOf(((Serializable) o));
298 }
299
300 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
301 } catch (IllegalAccessException e) {
302
303 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
304 } catch (InvocationTargetException e) {
305
306 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
307 } catch (SecurityException e) {
308
309 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
310 } catch (IllegalArgumentException e) {
311
312 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
313 } catch (ExceptionInInitializerError e) {
314
315 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
316 }
317 }
318 return null;
319 } catch (MimeTypeParseException e) {
320 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
321 } catch (URISyntaxException e) {
322 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
323 } catch (MalformedURLException e) {
324 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
325 }
326 }
327
328
329
330
331
332
333
334
335
336 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:19+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
337 private static Object copyOfArray(final Object array) {
338
339 if (array!= null) {
340 if (array.getClass() == boolean[].class) {
341 return copyOf(((boolean[]) array));
342 }
343 if (array.getClass() == byte[].class) {
344 return copyOf(((byte[]) array));
345 }
346 if (array.getClass() == char[].class) {
347 return copyOf(((char[]) array));
348 }
349 if (array.getClass() == double[].class) {
350 return copyOf(((double[]) array));
351 }
352 if (array.getClass() == float[].class) {
353 return copyOf(((float[]) array));
354 }
355 if (array.getClass() == int[].class) {
356 return copyOf(((int[]) array));
357 }
358 if (array.getClass() == long[].class) {
359 return copyOf(((long[]) array));
360 }
361 if (array.getClass() == short[].class) {
362 return copyOf(((short[]) array));
363 }
364 final int len = Array.getLength(array);
365 final Object copy = Array.newInstance(array.getClass().getComponentType(), len);
366 for (int i = (len- 1); (i >= 0); i--) {
367 Array.set(copy, i, copyOf(Array.get(array, i)));
368 }
369 return copy;
370 }
371 return null;
372 }
373
374
375
376
377
378
379
380
381
382 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:19+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
383 private static boolean[] copyOf(final boolean[] array) {
384
385 if (array!= null) {
386 final boolean[] copy = ((boolean[]) Array.newInstance(array.getClass().getComponentType(), array.length));
387 System.arraycopy(array, 0, copy, 0, array.length);
388 return copy;
389 }
390 return null;
391 }
392
393
394
395
396
397
398
399
400
401 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:19+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
402 private static byte[] copyOf(final byte[] array) {
403
404 if (array!= null) {
405 final byte[] copy = ((byte[]) Array.newInstance(array.getClass().getComponentType(), array.length));
406 System.arraycopy(array, 0, copy, 0, array.length);
407 return copy;
408 }
409 return null;
410 }
411
412
413
414
415
416
417
418
419
420 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:19+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
421 private static char[] copyOf(final char[] array) {
422
423 if (array!= null) {
424 final char[] copy = ((char[]) Array.newInstance(array.getClass().getComponentType(), array.length));
425 System.arraycopy(array, 0, copy, 0, array.length);
426 return copy;
427 }
428 return null;
429 }
430
431
432
433
434
435
436
437
438
439 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:19+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
440 private static double[] copyOf(final double[] array) {
441
442 if (array!= null) {
443 final double[] copy = ((double[]) Array.newInstance(array.getClass().getComponentType(), array.length));
444 System.arraycopy(array, 0, copy, 0, array.length);
445 return copy;
446 }
447 return null;
448 }
449
450
451
452
453
454
455
456
457
458 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:19+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
459 private static float[] copyOf(final float[] array) {
460
461 if (array!= null) {
462 final float[] copy = ((float[]) Array.newInstance(array.getClass().getComponentType(), array.length));
463 System.arraycopy(array, 0, copy, 0, array.length);
464 return copy;
465 }
466 return null;
467 }
468
469
470
471
472
473
474
475
476
477 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:19+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
478 private static int[] copyOf(final int[] array) {
479
480 if (array!= null) {
481 final int[] copy = ((int[]) 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
490
491
492
493
494
495
496 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:19+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
497 private static long[] copyOf(final long[] array) {
498
499 if (array!= null) {
500 final long[] copy = ((long[]) 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
509
510
511
512
513
514
515 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:19+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
516 private static short[] copyOf(final short[] array) {
517
518 if (array!= null) {
519 final short[] copy = ((short[]) 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
528
529
530
531
532
533
534 @SuppressWarnings("unchecked")
535 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:19+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
536 private static JAXBElement copyOf(final JAXBElement element) {
537
538 if (element!= null) {
539 final JAXBElement copy = new JAXBElement(element.getName(), element.getDeclaredType(), element.getScope(), element.getValue());
540 copy.setNil(element.isNil());
541 copy.setValue(copyOf(copy.getValue()));
542 return copy;
543 }
544 return null;
545 }
546
547
548
549
550
551
552
553
554
555 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:19+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
556 private static Serializable copyOf(final Serializable serializable) {
557
558 if (serializable!= null) {
559 try {
560 final ByteArrayOutputStream byteArrayOutput = new ByteArrayOutputStream();
561 final ObjectOutputStream out = new ObjectOutputStream(byteArrayOutput);
562 out.writeObject(serializable);
563 out.close();
564 final ByteArrayInputStream byteArrayInput = new ByteArrayInputStream(byteArrayOutput.toByteArray());
565 final ObjectInputStream in = new ObjectInputStream(byteArrayInput);
566 final Serializable copy = ((Serializable) in.readObject());
567 in.close();
568 return copy;
569 } catch (SecurityException e) {
570 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e));
571 } catch (ClassNotFoundException e) {
572 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e));
573 } catch (InvalidClassException e) {
574 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e));
575 } catch (NotSerializableException e) {
576 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e));
577 } catch (StreamCorruptedException e) {
578 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e));
579 } catch (OptionalDataException e) {
580 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e));
581 } catch (IOException e) {
582 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e));
583 }
584 }
585 return null;
586 }
587
588
589
590
591
592
593
594
595 @Override
596 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:19+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
597 public AnyModelObject clone() {
598 try {
599 {
600
601 final AnyModelObject clone = ((AnyModelObject) super.clone());
602
603 clone.any = ((this.any == null)?null:copyOfAny(this.getAny()));
604
605 clone.valid = this.isValid();
606 return clone;
607 }
608 } catch (CloneNotSupportedException e) {
609
610 throw new AssertionError(e);
611 }
612 }
613
614 }