001 //
002 // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-2
003 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
004 // Any modifications to this file will be lost upon recompilation of the source schema.
005 // Generated on: 2012.02.17 at 01:39:04 AM CET
006 //
007
008
009 package org.jomc.model.test;
010
011 import java.io.ByteArrayInputStream;
012 import java.io.ByteArrayOutputStream;
013 import java.io.File;
014 import java.io.IOException;
015 import java.io.InvalidClassException;
016 import java.io.NotSerializableException;
017 import java.io.ObjectInputStream;
018 import java.io.ObjectOutputStream;
019 import java.io.OptionalDataException;
020 import java.io.Serializable;
021 import java.io.StreamCorruptedException;
022 import java.lang.reflect.Array;
023 import java.lang.reflect.InvocationTargetException;
024 import java.math.BigDecimal;
025 import java.math.BigInteger;
026 import java.net.MalformedURLException;
027 import java.net.URI;
028 import java.net.URISyntaxException;
029 import java.net.URL;
030 import java.util.Calendar;
031 import java.util.Currency;
032 import java.util.Date;
033 import java.util.Locale;
034 import java.util.TimeZone;
035 import java.util.UUID;
036 import javax.activation.MimeType;
037 import javax.activation.MimeTypeParseException;
038 import javax.annotation.Generated;
039 import javax.xml.bind.JAXBElement;
040 import javax.xml.bind.annotation.XmlAccessType;
041 import javax.xml.bind.annotation.XmlAccessorType;
042 import javax.xml.bind.annotation.XmlAnyElement;
043 import javax.xml.bind.annotation.XmlAttribute;
044 import javax.xml.bind.annotation.XmlType;
045 import javax.xml.datatype.Duration;
046 import javax.xml.datatype.XMLGregorianCalendar;
047 import javax.xml.namespace.QName;
048 import org.w3c.dom.Element;
049
050
051 /**
052 * <p>Java class for AnyModelObject complex type.
053 *
054 * <p>The following schema fragment specifies the expected content contained within this class.
055 *
056 * <pre>
057 * <complexType name="AnyModelObject">
058 * <complexContent>
059 * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
060 * <sequence>
061 * <any processContents='lax' namespace='http://jomc.org/model' minOccurs="0"/>
062 * </sequence>
063 * <attribute name="valid" use="required" type="{http://www.w3.org/2001/XMLSchema}boolean" />
064 * </restriction>
065 * </complexContent>
066 * </complexType>
067 * </pre>
068 *
069 *
070 */
071 @XmlAccessorType(XmlAccessType.FIELD)
072 @XmlType(name = "AnyModelObject", namespace = "http://jomc.org/model/test", propOrder = {
073 "any"
074 })
075 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-02-17T01:39:04+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
076 public class AnyModelObject implements Cloneable
077 {
078
079 @XmlAnyElement(lax = true)
080 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-02-17T01:39:04+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
081 protected Object any;
082 @XmlAttribute(name = "valid", required = true)
083 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-02-17T01:39:04+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
084 protected boolean valid;
085
086 /**
087 * Creates a new {@code AnyModelObject} instance.
088 *
089 */
090 public AnyModelObject() {
091 // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000
092 super();
093 }
094
095 /**
096 * Creates a new {@code AnyModelObject} instance by deeply copying a given {@code AnyModelObject} instance.
097 *
098 *
099 * @param o
100 * The instance to copy.
101 * @throws NullPointerException
102 * if {@code o} is {@code null}.
103 */
104 public AnyModelObject(final AnyModelObject o) {
105 // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000
106 super();
107 if (o == null) {
108 throw new NullPointerException("Cannot create a copy of 'AnyModelObject' from 'null'.");
109 }
110 // 'Any' property.
111 this.any = ((o.any == null)?null:copyOfAny(o.getAny()));
112 // CBuiltinLeafInfo: java.lang.Boolean
113 this.valid = o.isValid();
114 }
115
116 /**
117 * Gets the value of the any property.
118 *
119 * @return
120 * possible object is
121 * {@link Element }
122 * {@link Object }
123 *
124 */
125 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-02-17T01:39:04+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
126 public Object getAny() {
127 return any;
128 }
129
130 /**
131 * Sets the value of the any property.
132 *
133 * @param value
134 * allowed object is
135 * {@link Element }
136 * {@link Object }
137 *
138 */
139 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-02-17T01:39:04+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
140 public void setAny(Object value) {
141 this.any = value;
142 }
143
144 /**
145 * Gets the value of the valid property.
146 *
147 */
148 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-02-17T01:39:04+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
149 public boolean isValid() {
150 return valid;
151 }
152
153 /**
154 * Sets the value of the valid property.
155 *
156 */
157 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-02-17T01:39:04+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
158 public void setValid(boolean value) {
159 this.valid = value;
160 }
161
162 /**
163 * Creates and returns a deep copy of property {@code Any}.
164 *
165 * @param source
166 * The source to copy from or {@code null}.
167 * @return
168 * A deep copy of {@code source} or {@code null} if {@code source} is {@code null}.
169 */
170 @SuppressWarnings("unchecked")
171 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-02-17T01:39:04+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
172 private static Object copyOfAny(final Object source) {
173 // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000
174 if (source!= null) {
175 if (source instanceof Element) {
176 // CWildcardTypeInfo: org.w3c.dom.Element
177 return ((Element)((Element) source).cloneNode(true));
178 }
179 if (source instanceof Object) {
180 // CBuiltinLeafInfo: java.lang.Object
181 return copyOf(((Object) source));
182 }
183 // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/
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 * Creates and returns a deep copy of a given object.
191 *
192 * @param o
193 * The instance to copy or {@code null}.
194 * @return
195 * A deep copy of {@code o} or {@code null} if {@code o} is {@code null}.
196 */
197 @SuppressWarnings("unchecked")
198 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-02-17T01:39:04+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
199 private static Object copyOf(final Object o) {
200 // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000
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 // Immutable types.
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 // String based types.
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 // Cloneable types.
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 // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/
300 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
301 } catch (IllegalAccessException e) {
302 // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/
303 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
304 } catch (InvocationTargetException e) {
305 // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/
306 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
307 } catch (SecurityException e) {
308 // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/
309 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
310 } catch (IllegalArgumentException e) {
311 // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/
312 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
313 } catch (ExceptionInInitializerError e) {
314 // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/
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 (MalformedURLException e) {
322 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
323 } catch (URISyntaxException e) {
324 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
325 }
326 }
327
328 /**
329 * Creates and returns a deep copy of a given array.
330 *
331 * @param array
332 * The array to copy or {@code null}.
333 * @return
334 * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}.
335 */
336 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-02-17T01:39:04+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
337 private static Object copyOfArray(final Object array) {
338 // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000
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 * Creates and returns a deep copy of a given array.
376 *
377 * @param array
378 * The array to copy or {@code null}.
379 * @return
380 * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}.
381 */
382 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-02-17T01:39:04+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
383 private static boolean[] copyOf(final boolean[] array) {
384 // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000
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 * Creates and returns a deep copy of a given array.
395 *
396 * @param array
397 * The array to copy or {@code null}.
398 * @return
399 * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}.
400 */
401 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-02-17T01:39:04+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
402 private static byte[] copyOf(final byte[] array) {
403 // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000
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 * Creates and returns a deep copy of a given array.
414 *
415 * @param array
416 * The array to copy or {@code null}.
417 * @return
418 * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}.
419 */
420 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-02-17T01:39:04+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
421 private static char[] copyOf(final char[] array) {
422 // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000
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 * Creates and returns a deep copy of a given array.
433 *
434 * @param array
435 * The array to copy or {@code null}.
436 * @return
437 * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}.
438 */
439 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-02-17T01:39:04+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
440 private static double[] copyOf(final double[] array) {
441 // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000
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 * Creates and returns a deep copy of a given array.
452 *
453 * @param array
454 * The array to copy or {@code null}.
455 * @return
456 * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}.
457 */
458 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-02-17T01:39:04+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
459 private static float[] copyOf(final float[] array) {
460 // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000
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 * Creates and returns a deep copy of a given array.
471 *
472 * @param array
473 * The array to copy or {@code null}.
474 * @return
475 * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}.
476 */
477 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-02-17T01:39:04+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
478 private static int[] copyOf(final int[] array) {
479 // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000
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 * Creates and returns a deep copy of a given array.
490 *
491 * @param array
492 * The array to copy or {@code null}.
493 * @return
494 * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}.
495 */
496 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-02-17T01:39:04+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
497 private static long[] copyOf(final long[] array) {
498 // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000
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 * Creates and returns a deep copy of a given array.
509 *
510 * @param array
511 * The array to copy or {@code null}.
512 * @return
513 * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}.
514 */
515 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-02-17T01:39:04+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
516 private static short[] copyOf(final short[] array) {
517 // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000
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 * Creates and returns a deep copy of a given {@code JAXBElement} instance.
528 *
529 * @param element
530 * The instance to copy or {@code null}.
531 * @return
532 * A deep copy of {@code element} or {@code null} if {@code element} is {@code null}.
533 */
534 @SuppressWarnings("unchecked")
535 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-02-17T01:39:04+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
536 private static JAXBElement copyOf(final JAXBElement element) {
537 // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000
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 * Creates and returns a deep copy of a given {@code Serializable}.
549 *
550 * @param serializable
551 * The instance to copy or {@code null}.
552 * @return
553 * A deep copy of {@code serializable} or {@code null} if {@code serializable} is {@code null}.
554 */
555 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-02-17T01:39:04+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
556 private static Serializable copyOf(final Serializable serializable) {
557 // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000
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 * Creates and returns a deep copy of this object.
590 *
591 *
592 * @return
593 * A deep copy of this object.
594 */
595 @Override
596 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-02-17T01:39:04+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
597 public AnyModelObject clone() {
598 try {
599 {
600 // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000
601 final AnyModelObject clone = ((AnyModelObject) super.clone());
602 // 'Any' property.
603 clone.any = ((this.any == null)?null:copyOfAny(this.getAny()));
604 // CBuiltinLeafInfo: java.lang.Boolean
605 clone.valid = this.isValid();
606 return clone;
607 }
608 } catch (CloneNotSupportedException e) {
609 // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/
610 throw new AssertionError(e);
611 }
612 }
613
614 }