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.XmlElement;
48 import javax.xml.bind.annotation.XmlType;
49 import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
50 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
51 import javax.xml.datatype.Duration;
52 import javax.xml.datatype.XMLGregorianCalendar;
53 import javax.xml.namespace.QName;
54 import org.w3c.dom.Element;
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97 @XmlAccessorType(XmlAccessType.FIELD)
98 @XmlType(name = "Instance", namespace = "http://jomc.org/model", propOrder = {
99 "specifications",
100 "dependencies",
101 "properties",
102 "messages",
103 "any"
104 })
105 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:16+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
106 public class Instance
107 extends ModelObject
108 implements Cloneable
109 {
110
111 @XmlElement(namespace = "http://jomc.org/model")
112 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:16+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
113 protected Specifications specifications;
114 @XmlElement(namespace = "http://jomc.org/model")
115 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:16+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
116 protected Dependencies dependencies;
117 @XmlElement(namespace = "http://jomc.org/model")
118 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:16+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
119 protected Properties properties;
120 @XmlElement(namespace = "http://jomc.org/model")
121 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:16+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
122 protected Messages messages;
123 @XmlAnyElement(lax = true)
124 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:16+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
125 protected List<Object> any;
126 @XmlAttribute(name = "identifier", required = true)
127 @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
128 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:16+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
129 protected String identifier;
130 @XmlAttribute(name = "name", required = true)
131 @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
132 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:16+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
133 protected String name;
134 @XmlAttribute(name = "class", required = true)
135 @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
136 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:16+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
137 protected String clazz;
138 @XmlAttribute(name = "stateless")
139 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:16+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
140 protected Boolean stateless;
141
142
143
144
145
146 public Instance() {
147
148 super();
149 }
150
151
152
153
154
155
156
157
158
159
160 public Instance(final Instance o) {
161
162 super(o);
163 if (o == null) {
164 throw new NullPointerException("Cannot create a copy of 'Instance' from 'null'.");
165 }
166
167 this.specifications = ((o.specifications == null)?null:((o.getSpecifications() == null)?null:o.getSpecifications().clone()));
168
169 this.dependencies = ((o.dependencies == null)?null:((o.getDependencies() == null)?null:o.getDependencies().clone()));
170
171 this.properties = ((o.properties == null)?null:((o.getProperties() == null)?null:o.getProperties().clone()));
172
173 this.messages = ((o.messages == null)?null:((o.getMessages() == null)?null:o.getMessages().clone()));
174
175 if (o.any!= null) {
176 copyAny(o.getAny(), this.getAny());
177 }
178
179 this.identifier = ((o.identifier == null)?null:o.getIdentifier());
180
181 this.name = ((o.name == null)?null:o.getName());
182
183 this.clazz = ((o.clazz == null)?null:o.getClazz());
184
185 this.stateless = ((o.stateless == null)?null:o.isStateless());
186 }
187
188
189
190
191
192
193
194
195
196 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:16+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
197 public Specifications getSpecifications() {
198 return specifications;
199 }
200
201
202
203
204
205
206
207
208
209 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:16+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
210 public void setSpecifications(Specifications value) {
211 this.specifications = value;
212 }
213
214
215
216
217
218
219
220
221
222 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:16+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
223 public Dependencies getDependencies() {
224 return dependencies;
225 }
226
227
228
229
230
231
232
233
234
235 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:16+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
236 public void setDependencies(Dependencies value) {
237 this.dependencies = value;
238 }
239
240
241
242
243
244
245
246
247
248 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:16+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
249 public Properties getProperties() {
250 return properties;
251 }
252
253
254
255
256
257
258
259
260
261 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:16+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
262 public void setProperties(Properties value) {
263 this.properties = value;
264 }
265
266
267
268
269
270
271
272
273
274 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:16+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
275 public Messages getMessages() {
276 return messages;
277 }
278
279
280
281
282
283
284
285
286
287 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:16+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
288 public void setMessages(Messages value) {
289 this.messages = value;
290 }
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:16+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
316 public List<Object> getAny() {
317 if (any == null) {
318 any = new ArrayList<Object>();
319 }
320 return this.any;
321 }
322
323
324
325
326
327
328
329
330
331 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:16+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
332 public String getIdentifier() {
333 return identifier;
334 }
335
336
337
338
339
340
341
342
343
344 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:16+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
345 public void setIdentifier(String value) {
346 this.identifier = value;
347 }
348
349
350
351
352
353
354
355
356
357 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:16+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
358 public String getName() {
359 return name;
360 }
361
362
363
364
365
366
367
368
369
370 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:16+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
371 public void setName(String value) {
372 this.name = value;
373 }
374
375
376
377
378
379
380
381
382
383 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:16+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
384 public String getClazz() {
385 return clazz;
386 }
387
388
389
390
391
392
393
394
395
396 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:16+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
397 public void setClazz(String value) {
398 this.clazz = value;
399 }
400
401
402
403
404
405
406
407
408
409 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:16+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
410 public boolean isStateless() {
411 if (stateless == null) {
412 return false;
413 } else {
414 return stateless;
415 }
416 }
417
418
419
420
421
422
423
424
425
426 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:16+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
427 public void setStateless(Boolean value) {
428 this.stateless = value;
429 }
430
431
432
433
434
435
436
437
438
439
440
441 @SuppressWarnings("unchecked")
442 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:16+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
443 private static void copyAny(final List<Object> source, final List<Object> target) {
444
445 if ((source!= null)&&(!source.isEmpty())) {
446 for (final Iterator<?> it = source.iterator(); it.hasNext(); ) {
447 final Object next = it.next();
448 if (next instanceof Element) {
449
450 target.add(((Element)((Element) next).cloneNode(true)));
451 continue;
452 }
453 if (next instanceof Object) {
454
455 target.add(copyOf(((Object) next)));
456 continue;
457 }
458
459 throw new AssertionError((("Unexpected instance '"+ next)+"' for property 'Any' of class 'org.jomc.model.Instance'."));
460 }
461 }
462 }
463
464
465
466
467
468
469
470
471
472 @SuppressWarnings("unchecked")
473 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:16+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
474 private static Object copyOf(final Object o) {
475
476 try {
477 if (o!= null) {
478 if (o.getClass().isPrimitive()) {
479 return o;
480 }
481 if (o.getClass().isArray()) {
482 return copyOfArray(o);
483 }
484
485 if (o instanceof Boolean) {
486 return o;
487 }
488 if (o instanceof Byte) {
489 return o;
490 }
491 if (o instanceof Character) {
492 return o;
493 }
494 if (o instanceof Double) {
495 return o;
496 }
497 if (o instanceof Enum) {
498 return o;
499 }
500 if (o instanceof Float) {
501 return o;
502 }
503 if (o instanceof Integer) {
504 return o;
505 }
506 if (o instanceof Long) {
507 return o;
508 }
509 if (o instanceof Short) {
510 return o;
511 }
512 if (o instanceof String) {
513 return o;
514 }
515 if (o instanceof BigDecimal) {
516 return o;
517 }
518 if (o instanceof BigInteger) {
519 return o;
520 }
521 if (o instanceof UUID) {
522 return o;
523 }
524 if (o instanceof QName) {
525 return o;
526 }
527 if (o instanceof Duration) {
528 return o;
529 }
530 if (o instanceof Currency) {
531 return o;
532 }
533
534 if (o instanceof File) {
535 return new File(o.toString());
536 }
537 if (o instanceof URI) {
538 return new URI(o.toString());
539 }
540 if (o instanceof URL) {
541 return new URL(o.toString());
542 }
543 if (o instanceof MimeType) {
544 return new MimeType(o.toString());
545 }
546
547 if (o instanceof XMLGregorianCalendar) {
548 return ((XMLGregorianCalendar) o).clone();
549 }
550 if (o instanceof Date) {
551 return ((Date) o).clone();
552 }
553 if (o instanceof Calendar) {
554 return ((Calendar) o).clone();
555 }
556 if (o instanceof TimeZone) {
557 return ((TimeZone) o).clone();
558 }
559 if (o instanceof Locale) {
560 return ((Locale) o).clone();
561 }
562 if (o instanceof Element) {
563 return ((Element)((Element) o).cloneNode(true));
564 }
565 if (o instanceof JAXBElement) {
566 return copyOf(((JAXBElement) o));
567 }
568 try {
569 return o.getClass().getMethod("clone", ((Class[]) null)).invoke(o, ((Object[]) null));
570 } catch (NoSuchMethodException e) {
571 if (o instanceof Serializable) {
572 return copyOf(((Serializable) o));
573 }
574
575 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
576 } catch (IllegalAccessException e) {
577
578 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
579 } catch (InvocationTargetException e) {
580
581 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
582 } catch (SecurityException e) {
583
584 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
585 } catch (IllegalArgumentException e) {
586
587 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
588 } catch (ExceptionInInitializerError e) {
589
590 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
591 }
592 }
593 return null;
594 } catch (MimeTypeParseException e) {
595 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
596 } catch (URISyntaxException e) {
597 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
598 } catch (MalformedURLException e) {
599 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
600 }
601 }
602
603
604
605
606
607
608
609
610
611 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:16+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
612 private static Object copyOfArray(final Object array) {
613
614 if (array!= null) {
615 if (array.getClass() == boolean[].class) {
616 return copyOf(((boolean[]) array));
617 }
618 if (array.getClass() == byte[].class) {
619 return copyOf(((byte[]) array));
620 }
621 if (array.getClass() == char[].class) {
622 return copyOf(((char[]) array));
623 }
624 if (array.getClass() == double[].class) {
625 return copyOf(((double[]) array));
626 }
627 if (array.getClass() == float[].class) {
628 return copyOf(((float[]) array));
629 }
630 if (array.getClass() == int[].class) {
631 return copyOf(((int[]) array));
632 }
633 if (array.getClass() == long[].class) {
634 return copyOf(((long[]) array));
635 }
636 if (array.getClass() == short[].class) {
637 return copyOf(((short[]) array));
638 }
639 final int len = Array.getLength(array);
640 final Object copy = Array.newInstance(array.getClass().getComponentType(), len);
641 for (int i = (len- 1); (i >= 0); i--) {
642 Array.set(copy, i, copyOf(Array.get(array, i)));
643 }
644 return copy;
645 }
646 return null;
647 }
648
649
650
651
652
653
654
655
656
657 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:16+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
658 private static boolean[] copyOf(final boolean[] array) {
659
660 if (array!= null) {
661 final boolean[] copy = ((boolean[]) Array.newInstance(array.getClass().getComponentType(), array.length));
662 System.arraycopy(array, 0, copy, 0, array.length);
663 return copy;
664 }
665 return null;
666 }
667
668
669
670
671
672
673
674
675
676 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:16+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
677 private static byte[] copyOf(final byte[] array) {
678
679 if (array!= null) {
680 final byte[] copy = ((byte[]) Array.newInstance(array.getClass().getComponentType(), array.length));
681 System.arraycopy(array, 0, copy, 0, array.length);
682 return copy;
683 }
684 return null;
685 }
686
687
688
689
690
691
692
693
694
695 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:16+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
696 private static char[] copyOf(final char[] array) {
697
698 if (array!= null) {
699 final char[] copy = ((char[]) Array.newInstance(array.getClass().getComponentType(), array.length));
700 System.arraycopy(array, 0, copy, 0, array.length);
701 return copy;
702 }
703 return null;
704 }
705
706
707
708
709
710
711
712
713
714 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:16+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
715 private static double[] copyOf(final double[] array) {
716
717 if (array!= null) {
718 final double[] copy = ((double[]) Array.newInstance(array.getClass().getComponentType(), array.length));
719 System.arraycopy(array, 0, copy, 0, array.length);
720 return copy;
721 }
722 return null;
723 }
724
725
726
727
728
729
730
731
732
733 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:16+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
734 private static float[] copyOf(final float[] array) {
735
736 if (array!= null) {
737 final float[] copy = ((float[]) Array.newInstance(array.getClass().getComponentType(), array.length));
738 System.arraycopy(array, 0, copy, 0, array.length);
739 return copy;
740 }
741 return null;
742 }
743
744
745
746
747
748
749
750
751
752 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:16+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
753 private static int[] copyOf(final int[] array) {
754
755 if (array!= null) {
756 final int[] copy = ((int[]) Array.newInstance(array.getClass().getComponentType(), array.length));
757 System.arraycopy(array, 0, copy, 0, array.length);
758 return copy;
759 }
760 return null;
761 }
762
763
764
765
766
767
768
769
770
771 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:16+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
772 private static long[] copyOf(final long[] array) {
773
774 if (array!= null) {
775 final long[] copy = ((long[]) Array.newInstance(array.getClass().getComponentType(), array.length));
776 System.arraycopy(array, 0, copy, 0, array.length);
777 return copy;
778 }
779 return null;
780 }
781
782
783
784
785
786
787
788
789
790 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:16+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
791 private static short[] copyOf(final short[] array) {
792
793 if (array!= null) {
794 final short[] copy = ((short[]) Array.newInstance(array.getClass().getComponentType(), array.length));
795 System.arraycopy(array, 0, copy, 0, array.length);
796 return copy;
797 }
798 return null;
799 }
800
801
802
803
804
805
806
807
808
809 @SuppressWarnings("unchecked")
810 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:16+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
811 private static JAXBElement copyOf(final JAXBElement element) {
812
813 if (element!= null) {
814 final JAXBElement copy = new JAXBElement(element.getName(), element.getDeclaredType(), element.getScope(), element.getValue());
815 copy.setNil(element.isNil());
816 copy.setValue(copyOf(copy.getValue()));
817 return copy;
818 }
819 return null;
820 }
821
822
823
824
825
826
827
828
829
830 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:16+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
831 private static Serializable copyOf(final Serializable serializable) {
832
833 if (serializable!= null) {
834 try {
835 final ByteArrayOutputStream byteArrayOutput = new ByteArrayOutputStream();
836 final ObjectOutputStream out = new ObjectOutputStream(byteArrayOutput);
837 out.writeObject(serializable);
838 out.close();
839 final ByteArrayInputStream byteArrayInput = new ByteArrayInputStream(byteArrayOutput.toByteArray());
840 final ObjectInputStream in = new ObjectInputStream(byteArrayInput);
841 final Serializable copy = ((Serializable) in.readObject());
842 in.close();
843 return copy;
844 } catch (SecurityException e) {
845 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e));
846 } catch (ClassNotFoundException e) {
847 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e));
848 } catch (InvalidClassException e) {
849 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e));
850 } catch (NotSerializableException e) {
851 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e));
852 } catch (StreamCorruptedException e) {
853 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e));
854 } catch (OptionalDataException e) {
855 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e));
856 } catch (IOException e) {
857 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e));
858 }
859 }
860 return null;
861 }
862
863
864
865
866
867
868
869
870 @Override
871 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:16+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
872 public Instance clone() {
873 {
874
875 final Instance clone = ((Instance) super.clone());
876
877 clone.specifications = ((this.specifications == null)?null:((this.getSpecifications() == null)?null:this.getSpecifications().clone()));
878
879 clone.dependencies = ((this.dependencies == null)?null:((this.getDependencies() == null)?null:this.getDependencies().clone()));
880
881 clone.properties = ((this.properties == null)?null:((this.getProperties() == null)?null:this.getProperties().clone()));
882
883 clone.messages = ((this.messages == null)?null:((this.getMessages() == null)?null:this.getMessages().clone()));
884
885 if (this.any!= null) {
886 clone.any = null;
887 copyAny(this.getAny(), clone.getAny());
888 }
889
890 clone.identifier = ((this.identifier == null)?null:this.getIdentifier());
891
892 clone.name = ((this.name == null)?null:this.getName());
893
894 clone.clazz = ((this.clazz == null)?null:this.getClazz());
895
896 clone.stateless = ((this.stateless == null)?null:this.isStateless());
897 return clone;
898 }
899 }
900
901
902
903
904
905 @javax.xml.bind.annotation.XmlTransient
906 private static final Class<?>[] NO_CLASSES =
907 {
908 };
909
910
911 @javax.xml.bind.annotation.XmlTransient private java.util.Map<String, Object> dependencyObjects;
912
913
914
915
916
917 @javax.xml.bind.annotation.XmlTransient private java.util.Map<String, java.util.Map<java.util.Locale, java.text.MessageFormat>> messageObjects;
918
919
920 @javax.xml.bind.annotation.XmlTransient private java.util.Map<String, Object> propertyObjects;
921
922
923
924
925
926
927
928
929 public java.util.Map<String, Object> getDependencyObjects()
930 {
931 if ( this.dependencyObjects == null )
932 {
933 this.dependencyObjects = new java.util.HashMap<String, Object>();
934 }
935
936 return this.dependencyObjects;
937 }
938
939
940
941
942
943
944
945
946
947
948 public java.util.Map<String, java.util.Map<java.util.Locale, java.text.MessageFormat>> getMessageObjects()
949 {
950 if ( this.messageObjects == null )
951 {
952 this.messageObjects =
953 new java.util.HashMap<String, java.util.Map<java.util.Locale, java.text.MessageFormat>>();
954
955 }
956
957 return this.messageObjects;
958 }
959
960
961
962
963
964
965
966
967 public java.util.Map<String, Object> getPropertyObjects()
968 {
969 if ( this.propertyObjects == null )
970 {
971 this.propertyObjects = new java.util.HashMap<String, Object>();
972 }
973
974 return this.propertyObjects;
975 }
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994 public Class<?> getJavaClass( final ClassLoader classLoader )
995 throws ClassNotFoundException, ModelObjectException
996 {
997 Class<?> javaClass = null;
998 final JavaTypeName javaTypeName = this.getJavaTypeName();
999
1000 if ( javaTypeName != null )
1001 {
1002 javaClass = javaTypeName.getClass( classLoader, false );
1003 }
1004
1005 return javaClass;
1006 }
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025 public Class<?>[] getJavaClasses( final ClassLoader classLoader )
1026 throws ClassNotFoundException, ModelObjectException
1027 {
1028 final java.util.Set<Class<?>> classes = new java.util.HashSet<Class<?>>();
1029
1030 if ( this.getSpecifications() != null )
1031 {
1032 for ( int i = 0, s0 = this.getSpecifications().getSpecification().size(); i < s0; i++ )
1033 {
1034 final Specification s = this.getSpecifications().getSpecification().get( i );
1035 final JavaTypeName javaTypeName = s.getJavaTypeName();
1036
1037 if ( javaTypeName != null )
1038 {
1039 classes.add( javaTypeName.getClass( classLoader, false ) );
1040 }
1041 }
1042 }
1043
1044 return classes.toArray( new Class<?>[ classes.size() ] );
1045 }
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064 public java.lang.reflect.Constructor<?> getJavaConstructor( final ClassLoader classLoader )
1065 throws ClassNotFoundException, ModelObjectException
1066 {
1067 java.lang.reflect.Constructor<?> javaConstructor = null;
1068 final JavaTypeName javaTypeName = this.getJavaTypeName();
1069
1070 if ( javaTypeName != null )
1071 {
1072 final Class<?> javaClass = javaTypeName.getClass( classLoader, false );
1073
1074 if ( java.lang.reflect.Modifier.isPublic( javaClass.getModifiers() )
1075 && !java.lang.reflect.Modifier.isAbstract( javaClass.getModifiers() ) )
1076 {
1077 try
1078 {
1079 javaConstructor = javaClass.getConstructor( NO_CLASSES );
1080 }
1081 catch ( final NoSuchMethodException e )
1082 {
1083 javaConstructor = null;
1084 }
1085 }
1086 }
1087
1088 return javaConstructor;
1089 }
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103 public String getJavaFactoryMethodName() throws ModelObjectException
1104 {
1105 try
1106 {
1107 String javaFactoryMethodName = null;
1108
1109 if ( this.getName() != null )
1110 {
1111 javaFactoryMethodName =
1112 JavaIdentifier.parse( "get" + JavaIdentifier.normalize(
1113 this.getName(), JavaIdentifier.NormalizationMode.CAMEL_CASE ) ).toString();
1114
1115 }
1116
1117 return javaFactoryMethodName;
1118 }
1119 catch ( final java.text.ParseException e )
1120 {
1121 throw new ModelObjectException( getMessage( "javaIdentifierParseException", this.getName(),
1122 getMessage( e ) ), e );
1123
1124 }
1125 }
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145 public java.lang.reflect.Method getJavaFactoryMethod( final ClassLoader classLoader )
1146 throws ClassNotFoundException, ModelObjectException
1147 {
1148 final JavaTypeName javaTypeName = this.getJavaTypeName();
1149 java.lang.reflect.Method factoryMethod = null;
1150
1151 if ( javaTypeName != null )
1152 {
1153 final Class<?> javaClass = javaTypeName.getClass( classLoader, false );
1154 final String methodName = this.getJavaFactoryMethodName();
1155
1156 if ( methodName != null )
1157 {
1158 try
1159 {
1160 factoryMethod = javaClass.getMethod( methodName, (Class[]) null );
1161 }
1162 catch ( final NoSuchMethodException e )
1163 {
1164 factoryMethod = null;
1165 }
1166 }
1167
1168 if ( factoryMethod == null )
1169 {
1170 try
1171 {
1172 factoryMethod = javaClass.getMethod( "getObject", (Class[]) null );
1173 }
1174 catch ( final NoSuchMethodException e )
1175 {
1176 factoryMethod = null;
1177 }
1178 }
1179 }
1180
1181 return factoryMethod;
1182 }
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204 public boolean isJavaClassAssignable( final ClassLoader classLoader )
1205 throws ClassNotFoundException, ModelObjectException
1206 {
1207 final JavaTypeName javaTypeName = this.getJavaTypeName();
1208 boolean assignable = javaTypeName != null;
1209
1210 if ( assignable )
1211 {
1212 final Class<?> javaClass = javaTypeName.getClass( classLoader, false );
1213 final Class<?>[] javaClasses = this.getJavaClasses( classLoader );
1214
1215 for ( int i = javaClasses.length - 1; i >= 0; i-- )
1216 {
1217 if ( !javaClasses[i].isAssignableFrom( javaClass ) )
1218 {
1219 assignable = false;
1220 break;
1221 }
1222 }
1223 }
1224
1225 return assignable;
1226 }
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245 public Class<?> getJavaProxyClass( final ClassLoader classLoader )
1246 throws ClassNotFoundException, ModelObjectException
1247 {
1248 final Class<?>[] javaClasses = this.getJavaClasses( classLoader );
1249 boolean canProxy = javaClasses.length > 0;
1250
1251 if ( canProxy )
1252 {
1253 for ( int i = javaClasses.length - 1; i >= 0; i-- )
1254 {
1255 if ( !javaClasses[i].isInterface() )
1256 {
1257 canProxy = false;
1258 break;
1259 }
1260 }
1261 }
1262
1263 return canProxy ? java.lang.reflect.Proxy.getProxyClass( classLoader, javaClasses ) : null;
1264 }
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278 public JavaTypeName getJavaTypeName() throws ModelObjectException
1279 {
1280 try
1281 {
1282 JavaTypeName javaTypeName = null;
1283
1284 if ( this.getClazz() != null )
1285 {
1286 javaTypeName = JavaTypeName.parse( this.getClazz() );
1287 }
1288
1289 return javaTypeName;
1290 }
1291 catch ( final java.text.ParseException e )
1292 {
1293 throw new ModelObjectException( getMessage( "javaTypeNameParseException", this.getClazz(),
1294 getMessage( e ) ), e );
1295
1296 }
1297 }
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317 @Deprecated
1318 public javax.xml.bind.JAXBElement getAnyElement( final String namespaceURI, final String localPart )
1319 {
1320 return this.getAnyElement( this.getAny(), namespaceURI, localPart );
1321 }
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340 @Deprecated
1341 public java.util.List<javax.xml.bind.JAXBElement> getAnyElements( final String namespaceURI,
1342 final String localPart )
1343 {
1344 return this.getAnyElements( this.getAny(), namespaceURI, localPart );
1345 }
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366 public <T> javax.xml.bind.JAXBElement<T> getAnyElement( final String namespaceURI, final String localPart,
1367 final Class<T> type )
1368 {
1369 return this.getAnyElement( this.getAny(), namespaceURI, localPart, type );
1370 }
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390 public <T> java.util.List<javax.xml.bind.JAXBElement<T>> getAnyElements( final String namespaceURI,
1391 final String localPart,
1392 final Class<T> type )
1393 {
1394 return this.getAnyElements( this.getAny(), namespaceURI, localPart, type );
1395 }
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411 public <T> T getAnyObject( final Class<T> clazz )
1412 {
1413 return this.getAnyObject( this.getAny(), clazz );
1414 }
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429 public <T> java.util.List<T> getAnyObjects( final Class<T> clazz )
1430 {
1431 return this.getAnyObjects( this.getAny(), clazz );
1432 }
1433
1434 private static String getMessage( final Throwable t )
1435 {
1436 return t != null
1437 ? t.getMessage() != null && t.getMessage().trim().length() > 0
1438 ? t.getMessage()
1439 : getMessage( t.getCause() )
1440 : null;
1441
1442 }
1443
1444 private static String getMessage( final String key, final Object... arguments )
1445 {
1446 return java.text.MessageFormat.format( java.util.ResourceBundle.getBundle(
1447 Instance.class.getName().replace( '.', '/' ), java.util.Locale.getDefault() ).
1448 getString( key ), arguments );
1449
1450 }
1451
1452 }