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