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