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: 2015.05.31 at 11:53:41 PM CEST 
006//
007
008
009package org.jomc.tools.model;
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.XmlAttribute;
047import javax.xml.bind.annotation.XmlElement;
048import javax.xml.bind.annotation.XmlType;
049import javax.xml.datatype.Duration;
050import javax.xml.datatype.XMLGregorianCalendar;
051import javax.xml.namespace.QName;
052import org.jomc.model.Inheritable;
053import org.w3c.dom.Element;
054
055
056/**
057 * Model of a source code file.
058 * 
059 * <p>Java class for SourceFileType complex type.
060 * 
061 * <p>The following schema fragment specifies the expected content contained within this class.
062 * 
063 * <pre>
064 * &lt;complexType name="SourceFileType">
065 *   &lt;complexContent>
066 *     &lt;extension base="{http://jomc.org/tools/model}ToolsType">
067 *       &lt;sequence>
068 *         &lt;element ref="{http://jomc.org/tools/model}source-sections" minOccurs="0"/>
069 *         &lt;element name="template-parameter" type="{http://jomc.org/tools/model}TemplateParameterType" maxOccurs="unbounded" minOccurs="0"/>
070 *         &lt;any processContents='lax' namespace='##other' maxOccurs="unbounded" minOccurs="0"/>
071 *       &lt;/sequence>
072 *       &lt;attribute name="identifier" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
073 *       &lt;attribute name="location" type="{http://www.w3.org/2001/XMLSchema}string" />
074 *       &lt;attribute name="template" type="{http://www.w3.org/2001/XMLSchema}string" />
075 *       &lt;attribute name="head-comment" type="{http://www.w3.org/2001/XMLSchema}string" />
076 *       &lt;attribute name="tail-comment" type="{http://www.w3.org/2001/XMLSchema}string" />
077 *       &lt;attribute name="final" type="{http://www.w3.org/2001/XMLSchema}boolean" default="false" />
078 *       &lt;attribute name="override" type="{http://www.w3.org/2001/XMLSchema}boolean" default="false" />
079 *     &lt;/extension>
080 *   &lt;/complexContent>
081 * &lt;/complexType>
082 * </pre>
083 * 
084 * 
085 */
086@XmlAccessorType(XmlAccessType.FIELD)
087@XmlType(name = "SourceFileType", namespace = "http://jomc.org/tools/model", propOrder = {
088    "sourceSections",
089    "templateParameter",
090    "any"
091})
092@Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T11:53:40+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
093public class SourceFileType
094    extends ToolsType
095    implements Cloneable, Inheritable
096{
097
098    @XmlElement(name = "source-sections", namespace = "http://jomc.org/tools/model")
099    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T11:53:40+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
100    protected SourceSectionsType sourceSections;
101    @XmlElement(name = "template-parameter", namespace = "http://jomc.org/tools/model")
102    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T11:53:40+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
103    protected List<TemplateParameterType> templateParameter;
104    @XmlAnyElement(lax = true)
105    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T11:53:40+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
106    protected List<Object> any;
107    @XmlAttribute(name = "identifier", required = true)
108    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T11:53:40+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
109    protected String identifier;
110    @XmlAttribute(name = "location")
111    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T11:53:40+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
112    protected String location;
113    @XmlAttribute(name = "template")
114    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T11:53:40+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
115    protected String template;
116    @XmlAttribute(name = "head-comment")
117    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T11:53:40+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
118    protected String headComment;
119    @XmlAttribute(name = "tail-comment")
120    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T11:53:40+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
121    protected String tailComment;
122    @XmlAttribute(name = "final")
123    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T11:53:40+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
124    protected Boolean _final;
125    @XmlAttribute(name = "override")
126    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T11:53:40+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
127    protected Boolean override;
128
129    /**
130     * Creates a new {@code SourceFileType} instance.
131     * 
132     */
133    public SourceFileType() {
134        // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000
135        super();
136    }
137
138    /**
139     * Creates a new {@code SourceFileType} instance by deeply copying a given {@code SourceFileType} instance.
140     * 
141     * 
142     * @param o
143     *     The instance to copy.
144     * @throws NullPointerException
145     *     if {@code o} is {@code null}.
146     */
147    public SourceFileType(final SourceFileType o) {
148        // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000
149        super(o);
150        if (o == null) {
151            throw new NullPointerException("Cannot create a copy of 'SourceFileType' from 'null'.");
152        }
153        // CClassInfo: org.jomc.tools.model.SourceSectionsType
154        this.sourceSections = ((o.sourceSections == null)?null:((o.getSourceSections() == null)?null:o.getSourceSections().clone()));
155        // 'TemplateParameter' collection.
156        if (o.templateParameter!= null) {
157            copyTemplateParameter(o.getTemplateParameter(), this.getTemplateParameter());
158        }
159        // 'Any' collection.
160        if (o.any!= null) {
161            copyAny(o.getAny(), this.getAny());
162        }
163        // CBuiltinLeafInfo: java.lang.String
164        this.identifier = ((o.identifier == null)?null:o.getIdentifier());
165        // CBuiltinLeafInfo: java.lang.String
166        this.location = ((o.location == null)?null:o.getLocation());
167        // CBuiltinLeafInfo: java.lang.String
168        this.template = ((o.template == null)?null:o.getTemplate());
169        // CBuiltinLeafInfo: java.lang.String
170        this.headComment = ((o.headComment == null)?null:o.getHeadComment());
171        // CBuiltinLeafInfo: java.lang.String
172        this.tailComment = ((o.tailComment == null)?null:o.getTailComment());
173        // CBuiltinLeafInfo: java.lang.Boolean
174        this._final = ((o._final == null)?null:o.isFinal());
175        // CBuiltinLeafInfo: java.lang.Boolean
176        this.override = ((o.override == null)?null:o.isOverride());
177    }
178
179    /**
180     * Sections of the source file.
181     * 
182     * @return
183     *     possible object is
184     *     {@link SourceSectionsType }
185     *     
186     */
187    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T11:53:40+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
188    public SourceSectionsType getSourceSections() {
189        return sourceSections;
190    }
191
192    /**
193     * Sets the value of the sourceSections property.
194     * 
195     * @param value
196     *     allowed object is
197     *     {@link SourceSectionsType }
198     *     
199     */
200    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T11:53:40+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
201    public void setSourceSections(SourceSectionsType value) {
202        this.sourceSections = value;
203    }
204
205    /**
206     * Gets the value of the templateParameter property.
207     * 
208     * <p>
209     * This accessor method returns a reference to the live list,
210     * not a snapshot. Therefore any modification you make to the
211     * returned list will be present inside the JAXB object.
212     * This is why there is not a <CODE>set</CODE> method for the templateParameter property.
213     * 
214     * <p>
215     * For example, to add a new item, do as follows:
216     * <pre>
217     *    getTemplateParameter().add(newItem);
218     * </pre>
219     * 
220     * 
221     * <p>
222     * Objects of the following type(s) are allowed in the list
223     * {@link TemplateParameterType }
224     * 
225     * 
226     */
227    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T11:53:40+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
228    public List<TemplateParameterType> getTemplateParameter() {
229        if (templateParameter == null) {
230            templateParameter = new ArrayList<TemplateParameterType>();
231        }
232        return this.templateParameter;
233    }
234
235    /**
236     * Gets the value of the any property.
237     * 
238     * <p>
239     * This accessor method returns a reference to the live list,
240     * not a snapshot. Therefore any modification you make to the
241     * returned list will be present inside the JAXB object.
242     * This is why there is not a <CODE>set</CODE> method for the any property.
243     * 
244     * <p>
245     * For example, to add a new item, do as follows:
246     * <pre>
247     *    getAny().add(newItem);
248     * </pre>
249     * 
250     * 
251     * <p>
252     * Objects of the following type(s) are allowed in the list
253     * {@link Object }
254     * {@link Element }
255     * 
256     * 
257     */
258    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T11:53:40+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
259    public List<Object> getAny() {
260        if (any == null) {
261            any = new ArrayList<Object>();
262        }
263        return this.any;
264    }
265
266    /**
267     * Gets the value of the identifier property.
268     * 
269     * @return
270     *     possible object is
271     *     {@link String }
272     *     
273     */
274    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T11:53:40+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
275    public String getIdentifier() {
276        return identifier;
277    }
278
279    /**
280     * Sets the value of the identifier property.
281     * 
282     * @param value
283     *     allowed object is
284     *     {@link String }
285     *     
286     */
287    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T11:53:40+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
288    public void setIdentifier(String value) {
289        this.identifier = value;
290    }
291
292    /**
293     * Gets the value of the location property.
294     * 
295     * @return
296     *     possible object is
297     *     {@link String }
298     *     
299     */
300    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T11:53:40+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
301    public String getLocation() {
302        return location;
303    }
304
305    /**
306     * Sets the value of the location property.
307     * 
308     * @param value
309     *     allowed object is
310     *     {@link String }
311     *     
312     */
313    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T11:53:40+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
314    public void setLocation(String value) {
315        this.location = value;
316    }
317
318    /**
319     * Gets the value of the template property.
320     * 
321     * @return
322     *     possible object is
323     *     {@link String }
324     *     
325     */
326    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T11:53:40+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
327    public String getTemplate() {
328        return template;
329    }
330
331    /**
332     * Sets the value of the template property.
333     * 
334     * @param value
335     *     allowed object is
336     *     {@link String }
337     *     
338     */
339    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T11:53:40+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
340    public void setTemplate(String value) {
341        this.template = value;
342    }
343
344    /**
345     * Gets the value of the headComment property.
346     * 
347     * @return
348     *     possible object is
349     *     {@link String }
350     *     
351     */
352    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T11:53:40+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
353    public String getHeadComment() {
354        return headComment;
355    }
356
357    /**
358     * Sets the value of the headComment property.
359     * 
360     * @param value
361     *     allowed object is
362     *     {@link String }
363     *     
364     */
365    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T11:53:40+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
366    public void setHeadComment(String value) {
367        this.headComment = value;
368    }
369
370    /**
371     * Gets the value of the tailComment property.
372     * 
373     * @return
374     *     possible object is
375     *     {@link String }
376     *     
377     */
378    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T11:53:40+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
379    public String getTailComment() {
380        return tailComment;
381    }
382
383    /**
384     * Sets the value of the tailComment property.
385     * 
386     * @param value
387     *     allowed object is
388     *     {@link String }
389     *     
390     */
391    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T11:53:40+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
392    public void setTailComment(String value) {
393        this.tailComment = value;
394    }
395
396    /**
397     * Gets the value of the final property.
398     * 
399     * @return
400     *     possible object is
401     *     {@link Boolean }
402     *     
403     */
404    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T11:53:40+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
405    public boolean isFinal() {
406        if (_final == null) {
407            return false;
408        } else {
409            return _final;
410        }
411    }
412
413    /**
414     * Sets the value of the final property.
415     * 
416     * @param value
417     *     allowed object is
418     *     {@link Boolean }
419     *     
420     */
421    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T11:53:40+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
422    public void setFinal(Boolean value) {
423        this._final = value;
424    }
425
426    /**
427     * Gets the value of the override property.
428     * 
429     * @return
430     *     possible object is
431     *     {@link Boolean }
432     *     
433     */
434    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T11:53:40+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
435    public boolean isOverride() {
436        if (override == null) {
437            return false;
438        } else {
439            return override;
440        }
441    }
442
443    /**
444     * Sets the value of the override property.
445     * 
446     * @param value
447     *     allowed object is
448     *     {@link Boolean }
449     *     
450     */
451    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T11:53:40+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
452    public void setOverride(Boolean value) {
453        this.override = value;
454    }
455
456    /**
457     * Copies all values of property {@code TemplateParameter} deeply.
458     * 
459     * @param source
460     *     The source to copy from.
461     * @param target
462     *     The target to copy {@code source} to.
463     * @throws NullPointerException
464     *     if {@code target} is {@code null}.
465     */
466    @SuppressWarnings("unchecked")
467    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T11:53:40+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
468    private static void copyTemplateParameter(final List<TemplateParameterType> source, final List<TemplateParameterType> target) {
469        // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000
470        if ((source!= null)&&(!source.isEmpty())) {
471            for (final Iterator<?> it = source.iterator(); it.hasNext(); ) {
472                final Object next = it.next();
473                if (next instanceof TemplateParameterType) {
474                    // CClassInfo: org.jomc.tools.model.TemplateParameterType
475                    target.add(((TemplateParameterType) next).clone());
476                    continue;
477                }
478                // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/
479                throw new AssertionError((("Unexpected instance '"+ next)+"' for property 'TemplateParameter' of class 'org.jomc.tools.model.SourceFileType'."));
480            }
481        }
482    }
483
484    /**
485     * Copies all values of property {@code Any} deeply.
486     * 
487     * @param source
488     *     The source to copy from.
489     * @param target
490     *     The target to copy {@code source} to.
491     * @throws NullPointerException
492     *     if {@code target} is {@code null}.
493     */
494    @SuppressWarnings("unchecked")
495    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T11:53:40+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
496    private static void copyAny(final List<Object> source, final List<Object> target) {
497        // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000
498        if ((source!= null)&&(!source.isEmpty())) {
499            for (final Iterator<?> it = source.iterator(); it.hasNext(); ) {
500                final Object next = it.next();
501                if (next instanceof Element) {
502                    // CWildcardTypeInfo: org.w3c.dom.Element
503                    target.add(((Element)((Element) next).cloneNode(true)));
504                    continue;
505                }
506                if (next instanceof Object) {
507                    // CBuiltinLeafInfo: java.lang.Object
508                    target.add(copyOf(((Object) next)));
509                    continue;
510                }
511                // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/
512                throw new AssertionError((("Unexpected instance '"+ next)+"' for property 'Any' of class 'org.jomc.tools.model.SourceFileType'."));
513            }
514        }
515    }
516
517    /**
518     * Creates and returns a deep copy of a given object.
519     * 
520     * @param o
521     *     The instance to copy or {@code null}.
522     * @return
523     *     A deep copy of {@code o} or {@code null} if {@code o} is {@code null}.
524     */
525    @SuppressWarnings("unchecked")
526    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T11:53:40+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
527    private static Object copyOf(final Object o) {
528        // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000
529        try {
530            if (o!= null) {
531                if (o.getClass().isPrimitive()) {
532                    return o;
533                }
534                if (o.getClass().isArray()) {
535                    return copyOfArray(o);
536                }
537                // Immutable types.
538                if (o instanceof Boolean) {
539                    return o;
540                }
541                if (o instanceof Byte) {
542                    return o;
543                }
544                if (o instanceof Character) {
545                    return o;
546                }
547                if (o instanceof Double) {
548                    return o;
549                }
550                if (o instanceof Enum) {
551                    return o;
552                }
553                if (o instanceof Float) {
554                    return o;
555                }
556                if (o instanceof Integer) {
557                    return o;
558                }
559                if (o instanceof Long) {
560                    return o;
561                }
562                if (o instanceof Short) {
563                    return o;
564                }
565                if (o instanceof String) {
566                    return o;
567                }
568                if (o instanceof BigDecimal) {
569                    return o;
570                }
571                if (o instanceof BigInteger) {
572                    return o;
573                }
574                if (o instanceof UUID) {
575                    return o;
576                }
577                if (o instanceof QName) {
578                    return o;
579                }
580                if (o instanceof Duration) {
581                    return o;
582                }
583                if (o instanceof Currency) {
584                    return o;
585                }
586                // String based types.
587                if (o instanceof File) {
588                    return new File(o.toString());
589                }
590                if (o instanceof URI) {
591                    return new URI(o.toString());
592                }
593                if (o instanceof URL) {
594                    return new URL(o.toString());
595                }
596                if (o instanceof MimeType) {
597                    return new MimeType(o.toString());
598                }
599                // Cloneable types.
600                if (o instanceof XMLGregorianCalendar) {
601                    return ((XMLGregorianCalendar) o).clone();
602                }
603                if (o instanceof Date) {
604                    return ((Date) o).clone();
605                }
606                if (o instanceof Calendar) {
607                    return ((Calendar) o).clone();
608                }
609                if (o instanceof TimeZone) {
610                    return ((TimeZone) o).clone();
611                }
612                if (o instanceof Locale) {
613                    return ((Locale) o).clone();
614                }
615                if (o instanceof Element) {
616                    return ((Element)((Element) o).cloneNode(true));
617                }
618                if (o instanceof JAXBElement) {
619                    return copyOf(((JAXBElement) o));
620                }
621                try {
622                    return o.getClass().getMethod("clone", ((Class[]) null)).invoke(o, ((Object[]) null));
623                } catch (NoSuchMethodException e) {
624                    if (o instanceof Serializable) {
625                        return copyOf(((Serializable) o));
626                    }
627                    // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/
628                    throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
629                } catch (IllegalAccessException e) {
630                    // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/
631                    throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
632                } catch (InvocationTargetException e) {
633                    // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/
634                    throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
635                } catch (SecurityException e) {
636                    // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/
637                    throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
638                } catch (IllegalArgumentException e) {
639                    // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/
640                    throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
641                } catch (ExceptionInInitializerError e) {
642                    // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/
643                    throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
644                }
645            }
646            return null;
647        } catch (MalformedURLException e) {
648            throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
649        } catch (MimeTypeParseException e) {
650            throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
651        } catch (URISyntaxException e) {
652            throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
653        }
654    }
655
656    /**
657     * Creates and returns a deep copy of a given array.
658     * 
659     * @param array
660     *     The array to copy or {@code null}.
661     * @return
662     *     A deep copy of {@code array} or {@code null} if {@code array} is {@code null}.
663     */
664    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T11:53:40+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
665    private static Object copyOfArray(final Object array) {
666        // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000
667        if (array!= null) {
668            if (array.getClass() == boolean[].class) {
669                return copyOf(((boolean[]) array));
670            }
671            if (array.getClass() == byte[].class) {
672                return copyOf(((byte[]) array));
673            }
674            if (array.getClass() == char[].class) {
675                return copyOf(((char[]) array));
676            }
677            if (array.getClass() == double[].class) {
678                return copyOf(((double[]) array));
679            }
680            if (array.getClass() == float[].class) {
681                return copyOf(((float[]) array));
682            }
683            if (array.getClass() == int[].class) {
684                return copyOf(((int[]) array));
685            }
686            if (array.getClass() == long[].class) {
687                return copyOf(((long[]) array));
688            }
689            if (array.getClass() == short[].class) {
690                return copyOf(((short[]) array));
691            }
692            final int len = Array.getLength(array);
693            final Object copy = Array.newInstance(array.getClass().getComponentType(), len);
694            for (int i = (len- 1); (i >= 0); i--) {
695                Array.set(copy, i, copyOf(Array.get(array, i)));
696            }
697            return copy;
698        }
699        return null;
700    }
701
702    /**
703     * Creates and returns a deep copy of a given array.
704     * 
705     * @param array
706     *     The array to copy or {@code null}.
707     * @return
708     *     A deep copy of {@code array} or {@code null} if {@code array} is {@code null}.
709     */
710    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T11:53:40+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
711    private static boolean[] copyOf(final boolean[] array) {
712        // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000
713        if (array!= null) {
714            final boolean[] copy = ((boolean[]) Array.newInstance(array.getClass().getComponentType(), array.length));
715            System.arraycopy(array, 0, copy, 0, array.length);
716            return copy;
717        }
718        return null;
719    }
720
721    /**
722     * Creates and returns a deep copy of a given array.
723     * 
724     * @param array
725     *     The array to copy or {@code null}.
726     * @return
727     *     A deep copy of {@code array} or {@code null} if {@code array} is {@code null}.
728     */
729    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T11:53:40+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
730    private static byte[] copyOf(final byte[] array) {
731        // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000
732        if (array!= null) {
733            final byte[] copy = ((byte[]) Array.newInstance(array.getClass().getComponentType(), array.length));
734            System.arraycopy(array, 0, copy, 0, array.length);
735            return copy;
736        }
737        return null;
738    }
739
740    /**
741     * Creates and returns a deep copy of a given array.
742     * 
743     * @param array
744     *     The array to copy or {@code null}.
745     * @return
746     *     A deep copy of {@code array} or {@code null} if {@code array} is {@code null}.
747     */
748    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T11:53:40+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
749    private static char[] copyOf(final char[] array) {
750        // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000
751        if (array!= null) {
752            final char[] copy = ((char[]) Array.newInstance(array.getClass().getComponentType(), array.length));
753            System.arraycopy(array, 0, copy, 0, array.length);
754            return copy;
755        }
756        return null;
757    }
758
759    /**
760     * Creates and returns a deep copy of a given array.
761     * 
762     * @param array
763     *     The array to copy or {@code null}.
764     * @return
765     *     A deep copy of {@code array} or {@code null} if {@code array} is {@code null}.
766     */
767    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T11:53:40+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
768    private static double[] copyOf(final double[] array) {
769        // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000
770        if (array!= null) {
771            final double[] copy = ((double[]) Array.newInstance(array.getClass().getComponentType(), array.length));
772            System.arraycopy(array, 0, copy, 0, array.length);
773            return copy;
774        }
775        return null;
776    }
777
778    /**
779     * Creates and returns a deep copy of a given array.
780     * 
781     * @param array
782     *     The array to copy or {@code null}.
783     * @return
784     *     A deep copy of {@code array} or {@code null} if {@code array} is {@code null}.
785     */
786    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T11:53:40+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
787    private static float[] copyOf(final float[] array) {
788        // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000
789        if (array!= null) {
790            final float[] copy = ((float[]) Array.newInstance(array.getClass().getComponentType(), array.length));
791            System.arraycopy(array, 0, copy, 0, array.length);
792            return copy;
793        }
794        return null;
795    }
796
797    /**
798     * Creates and returns a deep copy of a given array.
799     * 
800     * @param array
801     *     The array to copy or {@code null}.
802     * @return
803     *     A deep copy of {@code array} or {@code null} if {@code array} is {@code null}.
804     */
805    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T11:53:40+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
806    private static int[] copyOf(final int[] array) {
807        // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000
808        if (array!= null) {
809            final int[] copy = ((int[]) Array.newInstance(array.getClass().getComponentType(), array.length));
810            System.arraycopy(array, 0, copy, 0, array.length);
811            return copy;
812        }
813        return null;
814    }
815
816    /**
817     * Creates and returns a deep copy of a given array.
818     * 
819     * @param array
820     *     The array to copy or {@code null}.
821     * @return
822     *     A deep copy of {@code array} or {@code null} if {@code array} is {@code null}.
823     */
824    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T11:53:40+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
825    private static long[] copyOf(final long[] array) {
826        // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000
827        if (array!= null) {
828            final long[] copy = ((long[]) Array.newInstance(array.getClass().getComponentType(), array.length));
829            System.arraycopy(array, 0, copy, 0, array.length);
830            return copy;
831        }
832        return null;
833    }
834
835    /**
836     * Creates and returns a deep copy of a given array.
837     * 
838     * @param array
839     *     The array to copy or {@code null}.
840     * @return
841     *     A deep copy of {@code array} or {@code null} if {@code array} is {@code null}.
842     */
843    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T11:53:40+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
844    private static short[] copyOf(final short[] array) {
845        // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000
846        if (array!= null) {
847            final short[] copy = ((short[]) Array.newInstance(array.getClass().getComponentType(), array.length));
848            System.arraycopy(array, 0, copy, 0, array.length);
849            return copy;
850        }
851        return null;
852    }
853
854    /**
855     * Creates and returns a deep copy of a given {@code JAXBElement} instance.
856     * 
857     * @param element
858     *     The instance to copy or {@code null}.
859     * @return
860     *     A deep copy of {@code element} or {@code null} if {@code element} is {@code null}.
861     */
862    @SuppressWarnings("unchecked")
863    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T11:53:40+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
864    private static JAXBElement copyOf(final JAXBElement element) {
865        // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000
866        if (element!= null) {
867            final JAXBElement copy = new JAXBElement(element.getName(), element.getDeclaredType(), element.getScope(), element.getValue());
868            copy.setNil(element.isNil());
869            copy.setValue(copyOf(copy.getValue()));
870            return copy;
871        }
872        return null;
873    }
874
875    /**
876     * Creates and returns a deep copy of a given {@code Serializable}.
877     * 
878     * @param serializable
879     *     The instance to copy or {@code null}.
880     * @return
881     *     A deep copy of {@code serializable} or {@code null} if {@code serializable} is {@code null}.
882     */
883    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T11:53:40+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
884    private static Serializable copyOf(final Serializable serializable) {
885        // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000
886        if (serializable!= null) {
887            try {
888                final ByteArrayOutputStream byteArrayOutput = new ByteArrayOutputStream();
889                final ObjectOutputStream out = new ObjectOutputStream(byteArrayOutput);
890                out.writeObject(serializable);
891                out.close();
892                final ByteArrayInputStream byteArrayInput = new ByteArrayInputStream(byteArrayOutput.toByteArray());
893                final ObjectInputStream in = new ObjectInputStream(byteArrayInput);
894                final Serializable copy = ((Serializable) in.readObject());
895                in.close();
896                return copy;
897            } catch (SecurityException e) {
898                throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e));
899            } catch (ClassNotFoundException e) {
900                throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e));
901            } catch (InvalidClassException e) {
902                throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e));
903            } catch (NotSerializableException e) {
904                throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e));
905            } catch (StreamCorruptedException e) {
906                throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e));
907            } catch (OptionalDataException e) {
908                throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e));
909            } catch (IOException e) {
910                throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e));
911            }
912        }
913        return null;
914    }
915
916    /**
917     * Creates and returns a deep copy of this object.
918     * 
919     * 
920     * @return
921     *     A deep copy of this object.
922     */
923    @Override
924    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T11:53:40+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
925    public SourceFileType clone() {
926        {
927            // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000
928            final SourceFileType clone = ((SourceFileType) super.clone());
929            // CClassInfo: org.jomc.tools.model.SourceSectionsType
930            clone.sourceSections = ((this.sourceSections == null)?null:((this.getSourceSections() == null)?null:this.getSourceSections().clone()));
931            // 'TemplateParameter' collection.
932            if (this.templateParameter!= null) {
933                clone.templateParameter = null;
934                copyTemplateParameter(this.getTemplateParameter(), clone.getTemplateParameter());
935            }
936            // 'Any' collection.
937            if (this.any!= null) {
938                clone.any = null;
939                copyAny(this.getAny(), clone.getAny());
940            }
941            // CBuiltinLeafInfo: java.lang.String
942            clone.identifier = ((this.identifier == null)?null:this.getIdentifier());
943            // CBuiltinLeafInfo: java.lang.String
944            clone.location = ((this.location == null)?null:this.getLocation());
945            // CBuiltinLeafInfo: java.lang.String
946            clone.template = ((this.template == null)?null:this.getTemplate());
947            // CBuiltinLeafInfo: java.lang.String
948            clone.headComment = ((this.headComment == null)?null:this.getHeadComment());
949            // CBuiltinLeafInfo: java.lang.String
950            clone.tailComment = ((this.tailComment == null)?null:this.getTailComment());
951            // CBuiltinLeafInfo: java.lang.Boolean
952            clone._final = ((this._final == null)?null:this.isFinal());
953            // CBuiltinLeafInfo: java.lang.Boolean
954            clone.override = ((this.override == null)?null:this.isOverride());
955            return clone;
956        }
957    }
958    
959    /**
960     * Gets a single {@code JAXBElement} matching a namespace URI and local part from the {@code any} property of the
961     * instance.
962     *
963     * @param namespaceURI The namespace URI of the {@code JAXBElement} to return.
964     * @param localPart The local part of the {@code JAXBElement} to return.
965     * @param type The class of the type the element is bound to.
966     * @param <T> The type the element is bound to.
967     *
968     * @return The {@code JAXBElement} matching {@code namespaceURI} and {@code localPart} from the {@code any} property
969     * of the instance or {@code null}, if no such element is found.
970     *
971     * @throws NullPointerException if {@code namespaceURI}, {@code localPart} or {@code type} is {@code null}.
972     * @throws IllegalStateException if the {@code any} property contains more than one matching element.
973     *
974     * @see #getAnyElement(java.util.List, java.lang.String, java.lang.String, java.lang.Class)
975     */
976    public <T> javax.xml.bind.JAXBElement<T> getAnyElement( final String namespaceURI, final String localPart,
977                                                            final Class<T> type )
978    {
979        return this.getAnyElement( this.getAny(), namespaceURI, localPart, type );
980    }
981
982    /**
983     * Gets a list containing all {@code JAXBElement}s matching a namespace URI and local part from the {@code any}
984     * property of the instance.
985     *
986     * @param namespaceURI The namespace URI of the {@code JAXBElement}s to return.
987     * @param localPart The local part of the {@code JAXBElement}s to return.
988     * @param type The class of the type the elements are bound to.
989     * @param <T> The type the elements are bound to.
990     *
991     * @return An unmodifiable list of all {@code JAXBElement}s matching {@code namespaceURI} and {@code localPart} from
992     * the {@code any} property of the instance - an empty list if no such elements are found.
993     *
994     * @throws NullPointerException if {@code namespaceURI}, {@code localPart} or {@code type} is {@code null}.
995     *
996     * @see #getAnyElements(java.util.List, java.lang.String, java.lang.String, java.lang.Class)
997     */
998    public <T> java.util.List<javax.xml.bind.JAXBElement<T>> getAnyElements( final String namespaceURI,
999                                                                             final String localPart,
1000                                                                             final Class<T> type )
1001    {
1002        return this.getAnyElements( this.getAny(), namespaceURI, localPart, type );
1003    }
1004
1005    /**
1006     * Gets a single object matching a given class from the {@code any} property of the instance.
1007     *
1008     * @param clazz The class to return an instance of.
1009     * @param <T> The type of the object to return.
1010     *
1011     * @return The instance of {@code clazz} from the {@code any} property of the instance or {@code null}, if no such
1012     * instance is found.
1013     *
1014     * @throws NullPointerException if {@code clazz} is {@code null}.
1015     * @throws IllegalStateException if the {@code any} property contains more than one matching object.
1016     *
1017     * @see #getAnyObject(java.util.List, java.lang.Class)
1018     */
1019    public <T> T getAnyObject( final Class<T> clazz )
1020    {
1021        return this.getAnyObject( this.getAny(), clazz );
1022    }
1023
1024    /**
1025     * Gets a list containing all objects matching a given class from the {@code any} property of the instance.
1026     *
1027     * @param clazz The class to return all instances of.
1028     * @param <T> The type of the objects to return.
1029     *
1030     * @return An unmodifiable list of all instances of {@code clazz} from the {@code any} property of the instance -
1031     * an empty list if no such objects are found.
1032     *
1033     * @throws NullPointerException if {@code clazz} is {@code null}.
1034     *
1035     * @see #getAnyObjects(java.util.List, java.lang.Class)
1036     */
1037    public <T> java.util.List<T> getAnyObjects( final Class<T> clazz )
1038    {
1039        return this.getAnyObjects( this.getAny(), clazz );
1040    }
1041
1042    /**
1043     * Gets a template parameter for a given name from the list of template parameters.
1044     *
1045     * @param name The name of the template parameter to return.
1046     *
1047     * @return The first matching template parameter or {@code null}, if no such template parameter is found.
1048     *
1049     * @throws NullPointerException if {@code name} is {@code null}.
1050     *
1051     * @see #getTemplateParameter()
1052     * @see TemplateParameterType#getName()
1053     * @since 1.6
1054     */
1055    public TemplateParameterType getTemplateParameter( final String name )
1056    {
1057        if ( name == null )
1058        {
1059            throw new NullPointerException( "name" );
1060        }
1061
1062        for ( int i = 0, s0 = this.getTemplateParameter().size(); i < s0; i++ )
1063        {
1064            final TemplateParameterType t = this.getTemplateParameter().get( i );
1065
1066            if ( name.equals( t.getName() ) )
1067            {
1068                return t;
1069            }
1070        }
1071
1072        return null;
1073    }
1074      
1075}