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