001 //
002 // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833
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: 2009.10.02 at 06:12:00 PM UTC
006 //
007
008
009 package org.jomc.model.test;
010
011 import java.io.ByteArrayInputStream;
012 import java.io.ByteArrayOutputStream;
013 import java.io.IOException;
014 import java.io.InvalidClassException;
015 import java.io.NotSerializableException;
016 import java.io.ObjectInputStream;
017 import java.io.ObjectOutputStream;
018 import java.io.OptionalDataException;
019 import java.io.Serializable;
020 import java.io.StreamCorruptedException;
021 import java.lang.reflect.Array;
022 import java.lang.reflect.InvocationTargetException;
023 import java.math.BigDecimal;
024 import java.math.BigInteger;
025 import java.util.Calendar;
026 import java.util.Currency;
027 import java.util.Date;
028 import java.util.Locale;
029 import java.util.TimeZone;
030 import java.util.UUID;
031 import javax.annotation.Generated;
032 import javax.xml.bind.JAXBElement;
033 import javax.xml.bind.annotation.XmlAccessType;
034 import javax.xml.bind.annotation.XmlAccessorType;
035 import javax.xml.bind.annotation.XmlAnyElement;
036 import javax.xml.bind.annotation.XmlAttribute;
037 import javax.xml.bind.annotation.XmlType;
038 import javax.xml.datatype.Duration;
039 import javax.xml.datatype.XMLGregorianCalendar;
040 import javax.xml.namespace.QName;
041 import org.w3c.dom.Element;
042
043
044 /**
045 * <p>Java class for AnyModelObject complex type.
046 *
047 * <p>The following schema fragment specifies the expected content contained within this class.
048 *
049 * <pre>
050 * <complexType name="AnyModelObject">
051 * <complexContent>
052 * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
053 * <sequence>
054 * <any processContents='lax' namespace='http://jomc.org/model' minOccurs="0"/>
055 * </sequence>
056 * <attribute name="valid" use="required" type="{http://www.w3.org/2001/XMLSchema}boolean" />
057 * </restriction>
058 * </complexContent>
059 * </complexType>
060 * </pre>
061 *
062 *
063 */
064 @XmlAccessorType(XmlAccessType.FIELD)
065 @XmlType(name = "AnyModelObject", propOrder = {
066 "any"
067 })
068 @Generated(value = "com.sun.tools.xjc.Driver", date = "2009-10-02T06:12:00+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
069 public class AnyModelObject
070 implements Cloneable
071 {
072
073 @XmlAnyElement(lax = true)
074 @Generated(value = "com.sun.tools.xjc.Driver", date = "2009-10-02T06:12:00+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
075 protected Object any;
076 @XmlAttribute(required = true)
077 @Generated(value = "com.sun.tools.xjc.Driver", date = "2009-10-02T06:12:00+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
078 protected boolean valid;
079
080 /**
081 * Creates a new {@code AnyModelObject} instance.
082 *
083 */
084 public AnyModelObject() {
085 // CC-XJC Version 1.0 Build 2009-09-18T15:48:40+0000
086 super();
087 }
088
089 /**
090 * Creates a new {@code AnyModelObject} instance by deeply copying a given instance.
091 *
092 * @param o
093 * The instance to copy or {@code null}.
094 */
095 public AnyModelObject(final AnyModelObject o) {
096 // CC-XJC Version 1.0 Build 2009-09-18T15:48:40+0000
097 super();
098 if (o!= null) {
099 {
100 // 'Any' property.
101 this.any = copyAny(o.getAny());
102 // CBuiltinLeafInfo: java.lang.Boolean
103 this.valid = ((Boolean) o.isValid());
104 }
105 }
106 }
107
108 /**
109 * Gets the value of the any property.
110 *
111 * @return
112 * possible object is
113 * {@link Object }
114 * {@link Element }
115 *
116 */
117 @Generated(value = "com.sun.tools.xjc.Driver", date = "2009-10-02T06:12:00+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
118 public Object getAny() {
119 return any;
120 }
121
122 /**
123 * Sets the value of the any property.
124 *
125 * @param value
126 * allowed object is
127 * {@link Object }
128 * {@link Element }
129 *
130 */
131 @Generated(value = "com.sun.tools.xjc.Driver", date = "2009-10-02T06:12:00+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
132 public void setAny(Object value) {
133 this.any = value;
134 }
135
136 /**
137 * Flag indicating the model object is expected to be valid.
138 *
139 */
140 @Generated(value = "com.sun.tools.xjc.Driver", date = "2009-10-02T06:12:00+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
141 public boolean isValid() {
142 return valid;
143 }
144
145 /**
146 * Sets the value of the valid property.
147 *
148 */
149 @Generated(value = "com.sun.tools.xjc.Driver", date = "2009-10-02T06:12:00+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
150 public void setValid(boolean value) {
151 this.valid = value;
152 }
153
154 /**
155 * Creates and returns a deep copy of property {@code Any}.
156 *
157 * @param source
158 * The source to copy from or {@code null}.
159 * @return
160 * A deep copy of {@code source} or {@code null} if {@code source} is {@code null}.
161 */
162 @Generated(value = "com.sun.tools.xjc.Driver", date = "2009-10-02T06:12:00+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
163 private static Object copyAny(final Object source) {
164 // CC-XJC Version 1.0 Build 2009-09-18T15:48:40+0000
165 if (source!= null) {
166 if (source instanceof Element) {
167 // CWildcardTypeInfo: org.w3c.dom.Element
168 return ((Element)((Element) source).cloneNode(true));
169 }
170 if (source instanceof Object) {
171 // CBuiltinLeafInfo: java.lang.Object
172 return copyOfObject(((Object) source));
173 }
174 // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/
175 throw new AssertionError((("Unexpected instance '"+ source)+"' for property 'Any' of class 'org.jomc.model.test.AnyModelObject'."));
176 }
177 return null;
178 }
179
180 /**
181 * Creates and returns a deep copy of a given object.
182 *
183 * @param o
184 * The instance to copy or {@code null}.
185 * @return
186 * A deep copy of {@code o} or {@code null} if {@code o} is {@code null}.
187 */
188 @Generated(value = "com.sun.tools.xjc.Driver", date = "2009-10-02T06:12:00+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
189 private static Object copyOfObject(final Object o) {
190 // CC-XJC Version 1.0 Build 2009-09-18T15:48:40+0000
191 if (o!= null) {
192 if (o.getClass().isPrimitive()) {
193 return o;
194 }
195 if (o.getClass().isArray()) {
196 return copyOfArray(o);
197 }
198 if (o instanceof Boolean) {
199 return o;
200 }
201 if (o instanceof Byte) {
202 return o;
203 }
204 if (o instanceof Character) {
205 return o;
206 }
207 if (o instanceof Double) {
208 return o;
209 }
210 if (o instanceof Enum) {
211 return o;
212 }
213 if (o instanceof Float) {
214 return o;
215 }
216 if (o instanceof Integer) {
217 return o;
218 }
219 if (o instanceof Long) {
220 return o;
221 }
222 if (o instanceof Short) {
223 return o;
224 }
225 if (o instanceof String) {
226 return o;
227 }
228 if (o instanceof BigDecimal) {
229 return o;
230 }
231 if (o instanceof BigInteger) {
232 return o;
233 }
234 if (o instanceof UUID) {
235 return o;
236 }
237 if (o instanceof QName) {
238 return o;
239 }
240 if (o instanceof Duration) {
241 return o;
242 }
243 if (o instanceof Currency) {
244 return o;
245 }
246 if (o instanceof XMLGregorianCalendar) {
247 return ((XMLGregorianCalendar) o).clone();
248 }
249 if (o instanceof Date) {
250 return ((Date) o).clone();
251 }
252 if (o instanceof Calendar) {
253 return ((Calendar) o).clone();
254 }
255 if (o instanceof TimeZone) {
256 return ((TimeZone) o).clone();
257 }
258 if (o instanceof Locale) {
259 return ((Locale) o).clone();
260 }
261 if (o instanceof Element) {
262 return ((Element)((Element) o).cloneNode(true));
263 }
264 if (o instanceof JAXBElement) {
265 return copyOFJAXBElement(((JAXBElement) o));
266 }
267 try {
268 return o.getClass().getMethod("clone", ((Class[]) null)).invoke(o, ((Object[]) null));
269 } catch (NoSuchMethodException e) {
270 if (o instanceof Serializable) {
271 return copyOfSerializable(((Serializable) o));
272 }
273 // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/
274 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
275 } catch (IllegalAccessException e) {
276 // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/
277 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
278 } catch (InvocationTargetException e) {
279 // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/
280 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
281 } catch (SecurityException e) {
282 // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/
283 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
284 } catch (IllegalArgumentException e) {
285 // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/
286 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
287 } catch (ExceptionInInitializerError e) {
288 // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/
289 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
290 }
291 }
292 return null;
293 }
294
295 /**
296 * Creates and returns a deep copy of a given array.
297 *
298 * @param array
299 * The array to copy or {@code null}.
300 * @return
301 * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}.
302 */
303 @Generated(value = "com.sun.tools.xjc.Driver", date = "2009-10-02T06:12:00+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
304 private static Object copyOfArray(final Object array) {
305 // CC-XJC Version 1.0 Build 2009-09-18T15:48:40+0000
306 if (array!= null) {
307 if (array.getClass() == boolean[].class) {
308 return copyOf(((boolean[]) array));
309 }
310 if (array.getClass() == byte[].class) {
311 return copyOf(((byte[]) array));
312 }
313 if (array.getClass() == char[].class) {
314 return copyOf(((char[]) array));
315 }
316 if (array.getClass() == double[].class) {
317 return copyOf(((double[]) array));
318 }
319 if (array.getClass() == float[].class) {
320 return copyOf(((float[]) array));
321 }
322 if (array.getClass() == int[].class) {
323 return copyOf(((int[]) array));
324 }
325 if (array.getClass() == long[].class) {
326 return copyOf(((long[]) array));
327 }
328 if (array.getClass() == short[].class) {
329 return copyOf(((short[]) array));
330 }
331 final int len = Array.getLength(array);
332 final Object copy = Array.newInstance(array.getClass().getComponentType(), len);
333 for (int i = (len- 1); (i >= 0); i--) {
334 Array.set(copy, i, copyOfObject(Array.get(array, i)));
335 }
336 return copy;
337 }
338 return null;
339 }
340
341 /**
342 * Creates and returns a deep copy of a given array.
343 *
344 * @param array
345 * The array to copy or {@code null}.
346 * @return
347 * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}.
348 */
349 @Generated(value = "com.sun.tools.xjc.Driver", date = "2009-10-02T06:12:00+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
350 private static boolean[] copyOf(final boolean[] array) {
351 // CC-XJC Version 1.0 Build 2009-09-18T15:48:40+0000
352 if (array!= null) {
353 final boolean[] copy = ((boolean[]) Array.newInstance(array.getClass().getComponentType(), array.length));
354 System.arraycopy(array, 0, copy, 0, array.length);
355 return copy;
356 }
357 return null;
358 }
359
360 /**
361 * Creates and returns a deep copy of a given array.
362 *
363 * @param array
364 * The array to copy or {@code null}.
365 * @return
366 * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}.
367 */
368 @Generated(value = "com.sun.tools.xjc.Driver", date = "2009-10-02T06:12:00+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
369 private static byte[] copyOf(final byte[] array) {
370 // CC-XJC Version 1.0 Build 2009-09-18T15:48:40+0000
371 if (array!= null) {
372 final byte[] copy = ((byte[]) Array.newInstance(array.getClass().getComponentType(), array.length));
373 System.arraycopy(array, 0, copy, 0, array.length);
374 return copy;
375 }
376 return null;
377 }
378
379 /**
380 * Creates and returns a deep copy of a given array.
381 *
382 * @param array
383 * The array to copy or {@code null}.
384 * @return
385 * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}.
386 */
387 @Generated(value = "com.sun.tools.xjc.Driver", date = "2009-10-02T06:12:00+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
388 private static char[] copyOf(final char[] array) {
389 // CC-XJC Version 1.0 Build 2009-09-18T15:48:40+0000
390 if (array!= null) {
391 final char[] copy = ((char[]) Array.newInstance(array.getClass().getComponentType(), array.length));
392 System.arraycopy(array, 0, copy, 0, array.length);
393 return copy;
394 }
395 return null;
396 }
397
398 /**
399 * Creates and returns a deep copy of a given array.
400 *
401 * @param array
402 * The array to copy or {@code null}.
403 * @return
404 * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}.
405 */
406 @Generated(value = "com.sun.tools.xjc.Driver", date = "2009-10-02T06:12:00+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
407 private static double[] copyOf(final double[] array) {
408 // CC-XJC Version 1.0 Build 2009-09-18T15:48:40+0000
409 if (array!= null) {
410 final double[] copy = ((double[]) Array.newInstance(array.getClass().getComponentType(), array.length));
411 System.arraycopy(array, 0, copy, 0, array.length);
412 return copy;
413 }
414 return null;
415 }
416
417 /**
418 * Creates and returns a deep copy of a given array.
419 *
420 * @param array
421 * The array to copy or {@code null}.
422 * @return
423 * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}.
424 */
425 @Generated(value = "com.sun.tools.xjc.Driver", date = "2009-10-02T06:12:00+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
426 private static float[] copyOf(final float[] array) {
427 // CC-XJC Version 1.0 Build 2009-09-18T15:48:40+0000
428 if (array!= null) {
429 final float[] copy = ((float[]) Array.newInstance(array.getClass().getComponentType(), array.length));
430 System.arraycopy(array, 0, copy, 0, array.length);
431 return copy;
432 }
433 return null;
434 }
435
436 /**
437 * Creates and returns a deep copy of a given array.
438 *
439 * @param array
440 * The array to copy or {@code null}.
441 * @return
442 * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}.
443 */
444 @Generated(value = "com.sun.tools.xjc.Driver", date = "2009-10-02T06:12:00+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
445 private static int[] copyOf(final int[] array) {
446 // CC-XJC Version 1.0 Build 2009-09-18T15:48:40+0000
447 if (array!= null) {
448 final int[] copy = ((int[]) Array.newInstance(array.getClass().getComponentType(), array.length));
449 System.arraycopy(array, 0, copy, 0, array.length);
450 return copy;
451 }
452 return null;
453 }
454
455 /**
456 * Creates and returns a deep copy of a given array.
457 *
458 * @param array
459 * The array to copy or {@code null}.
460 * @return
461 * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}.
462 */
463 @Generated(value = "com.sun.tools.xjc.Driver", date = "2009-10-02T06:12:00+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
464 private static long[] copyOf(final long[] array) {
465 // CC-XJC Version 1.0 Build 2009-09-18T15:48:40+0000
466 if (array!= null) {
467 final long[] copy = ((long[]) Array.newInstance(array.getClass().getComponentType(), array.length));
468 System.arraycopy(array, 0, copy, 0, array.length);
469 return copy;
470 }
471 return null;
472 }
473
474 /**
475 * Creates and returns a deep copy of a given array.
476 *
477 * @param array
478 * The array to copy or {@code null}.
479 * @return
480 * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}.
481 */
482 @Generated(value = "com.sun.tools.xjc.Driver", date = "2009-10-02T06:12:00+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
483 private static short[] copyOf(final short[] array) {
484 // CC-XJC Version 1.0 Build 2009-09-18T15:48:40+0000
485 if (array!= null) {
486 final short[] copy = ((short[]) Array.newInstance(array.getClass().getComponentType(), array.length));
487 System.arraycopy(array, 0, copy, 0, array.length);
488 return copy;
489 }
490 return null;
491 }
492
493 /**
494 * Creates and returns a deep copy of a given {@code JAXBElement} instance.
495 *
496 * @param element
497 * The instance to copy or {@code null}.
498 * @return
499 * A deep copy of {@code element} or {@code null} if {@code element} is {@code null}.
500 */
501 @Generated(value = "com.sun.tools.xjc.Driver", date = "2009-10-02T06:12:00+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
502 private static JAXBElement copyOFJAXBElement(final JAXBElement element) {
503 // CC-XJC Version 1.0 Build 2009-09-18T15:48:40+0000
504 if (element!= null) {
505 final JAXBElement copy = new JAXBElement(element.getName(), element.getDeclaredType(), element.getScope(), element.getValue());
506 copy.setNil(element.isNil());
507 copy.setValue(copyOfObject(copy.getValue()));
508 return copy;
509 }
510 return null;
511 }
512
513 /**
514 * Creates and returns a deep copy of a given {@code Serializable}.
515 *
516 * @param serializable
517 * The instance to copy or {@code null}.
518 * @return
519 * A deep copy of {@code serializable} or {@code null} if {@code serializable} is {@code null}.
520 */
521 @Generated(value = "com.sun.tools.xjc.Driver", date = "2009-10-02T06:12:00+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
522 private static Serializable copyOfSerializable(final Serializable serializable) {
523 // CC-XJC Version 1.0 Build 2009-09-18T15:48:40+0000
524 if (serializable!= null) {
525 try {
526 final ByteArrayOutputStream byteArrayOutput = new ByteArrayOutputStream();
527 final ObjectOutputStream out = new ObjectOutputStream(byteArrayOutput);
528 out.writeObject(serializable);
529 out.close();
530 final ByteArrayInputStream byteArrayInput = new ByteArrayInputStream(byteArrayOutput.toByteArray());
531 final ObjectInputStream in = new ObjectInputStream(byteArrayInput);
532 final Serializable copy = ((Serializable) in.readObject());
533 in.close();
534 return copy;
535 } catch (SecurityException e) {
536 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e));
537 } catch (ClassNotFoundException e) {
538 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e));
539 } catch (InvalidClassException e) {
540 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e));
541 } catch (NotSerializableException e) {
542 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e));
543 } catch (StreamCorruptedException e) {
544 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e));
545 } catch (OptionalDataException e) {
546 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e));
547 } catch (IOException e) {
548 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e));
549 }
550 }
551 return null;
552 }
553
554 /**
555 * Creates and returns a deep copy of this object.
556 *
557 *
558 * @return
559 * A deep copy of this object.
560 */
561 @Override
562 @Generated(value = "com.sun.tools.xjc.Driver", date = "2009-10-02T06:12:00+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
563 public AnyModelObject clone() {
564 // CC-XJC Version 1.0 Build 2009-09-18T15:48:40+0000
565 return new AnyModelObject(this);
566 }
567
568 }