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