SourceSectionType.java

//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-2 
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
// Any modifications to this file will be lost upon recompilation of the source schema. 
// Generated on: 2015.05.31 at 05:43:54 PM CEST 
//


package org.jomc.tools.model;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.InvalidClassException;
import java.io.NotSerializableException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OptionalDataException;
import java.io.Serializable;
import java.io.StreamCorruptedException;
import java.lang.reflect.Array;
import java.lang.reflect.InvocationTargetException;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Currency;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.TimeZone;
import java.util.UUID;
import javax.activation.MimeType;
import javax.activation.MimeTypeParseException;
import javax.annotation.Generated;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAnyElement;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.datatype.Duration;
import javax.xml.datatype.XMLGregorianCalendar;
import javax.xml.namespace.QName;
import org.w3c.dom.Element;


/**
 * Model of a source code file section.
 * 
 * <p>Java class for SourceSectionType complex type.
 * 
 * <p>The following schema fragment specifies the expected content contained within this class.
 * 
 * <pre>
 * &lt;complexType name="SourceSectionType">
 *   &lt;complexContent>
 *     &lt;extension base="{http://jomc.org/tools/model}ToolsType">
 *       &lt;sequence>
 *         &lt;element ref="{http://jomc.org/tools/model}source-sections" minOccurs="0"/>
 *         &lt;element name="template-parameter" type="{http://jomc.org/tools/model}TemplateParameterType" maxOccurs="unbounded" minOccurs="0"/>
 *         &lt;any processContents='lax' namespace='##other' maxOccurs="unbounded" minOccurs="0"/>
 *       &lt;/sequence>
 *       &lt;attribute name="name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
 *       &lt;attribute name="head-template" type="{http://www.w3.org/2001/XMLSchema}string" />
 *       &lt;attribute name="tail-template" type="{http://www.w3.org/2001/XMLSchema}string" />
 *       &lt;attribute name="indentationLevel" type="{http://www.w3.org/2001/XMLSchema}int" default="0" />
 *       &lt;attribute name="optional" type="{http://www.w3.org/2001/XMLSchema}boolean" default="false" />
 *       &lt;attribute name="editable" type="{http://www.w3.org/2001/XMLSchema}boolean" default="false" />
 *     &lt;/extension>
 *   &lt;/complexContent>
 * &lt;/complexType>
 * </pre>
 * 
 * 
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "SourceSectionType", namespace = "http://jomc.org/tools/model", propOrder = {
    "sourceSections",
    "templateParameter",
    "any"
})
@Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T05:43:54+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
public class SourceSectionType
    extends ToolsType
    implements Cloneable
{

    @XmlElement(name = "source-sections", namespace = "http://jomc.org/tools/model")
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T05:43:54+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
    protected SourceSectionsType sourceSections;
    @XmlElement(name = "template-parameter", namespace = "http://jomc.org/tools/model")
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T05:43:54+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
    protected List<TemplateParameterType> templateParameter;
    @XmlAnyElement(lax = true)
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T05:43:54+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
    protected List<Object> any;
    @XmlAttribute(name = "name", required = true)
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T05:43:54+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
    protected String name;
    @XmlAttribute(name = "head-template")
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T05:43:54+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
    protected String headTemplate;
    @XmlAttribute(name = "tail-template")
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T05:43:54+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
    protected String tailTemplate;
    @XmlAttribute(name = "indentationLevel")
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T05:43:54+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
    protected Integer indentationLevel;
    @XmlAttribute(name = "optional")
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T05:43:54+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
    protected Boolean optional;
    @XmlAttribute(name = "editable")
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T05:43:54+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
    protected Boolean editable;

    /**
     * Creates a new {@code SourceSectionType} instance.
     * 
     */
    public SourceSectionType() {
        // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000
        super();
    }

    /**
     * Creates a new {@code SourceSectionType} instance by deeply copying a given {@code SourceSectionType} instance.
     * 
     * 
     * @param o
     *     The instance to copy.
     * @throws NullPointerException
     *     if {@code o} is {@code null}.
     */
    public SourceSectionType(final SourceSectionType o) {
        // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000
        super(o);
        if (o == null) {
            throw new NullPointerException("Cannot create a copy of 'SourceSectionType' from 'null'.");
        }
        // CClassInfo: org.jomc.tools.model.SourceSectionsType
        this.sourceSections = ((o.sourceSections == null)?null:((o.getSourceSections() == null)?null:o.getSourceSections().clone()));
        // 'TemplateParameter' collection.
        if (o.templateParameter!= null) {
            copyTemplateParameter(o.getTemplateParameter(), this.getTemplateParameter());
        }
        // 'Any' collection.
        if (o.any!= null) {
            copyAny(o.getAny(), this.getAny());
        }
        // CBuiltinLeafInfo: java.lang.String
        this.name = ((o.name == null)?null:o.getName());
        // CBuiltinLeafInfo: java.lang.String
        this.headTemplate = ((o.headTemplate == null)?null:o.getHeadTemplate());
        // CBuiltinLeafInfo: java.lang.String
        this.tailTemplate = ((o.tailTemplate == null)?null:o.getTailTemplate());
        // CBuiltinLeafInfo: java.lang.Integer
        this.indentationLevel = ((o.indentationLevel == null)?null:o.getIndentationLevel());
        // CBuiltinLeafInfo: java.lang.Boolean
        this.optional = ((o.optional == null)?null:o.isOptional());
        // CBuiltinLeafInfo: java.lang.Boolean
        this.editable = ((o.editable == null)?null:o.isEditable());
    }

    /**
     * Child sections of the section.
     * 
     * @return
     *     possible object is
     *     {@link SourceSectionsType }
     *     
     */
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T05:43:54+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
    public SourceSectionsType getSourceSections() {
        return sourceSections;
    }

    /**
     * Sets the value of the sourceSections property.
     * 
     * @param value
     *     allowed object is
     *     {@link SourceSectionsType }
     *     
     */
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T05:43:54+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
    public void setSourceSections(SourceSectionsType value) {
        this.sourceSections = value;
    }

    /**
     * Gets the value of the templateParameter property.
     * 
     * <p>
     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a <CODE>set</CODE> method for the templateParameter property.
     * 
     * <p>
     * For example, to add a new item, do as follows:
     * <pre>
     *    getTemplateParameter().add(newItem);
     * </pre>
     * 
     * 
     * <p>
     * Objects of the following type(s) are allowed in the list
     * {@link TemplateParameterType }
     * 
     * 
     */
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T05:43:54+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
    public List<TemplateParameterType> getTemplateParameter() {
        if (templateParameter == null) {
            templateParameter = new ArrayList<TemplateParameterType>();
        }
        return this.templateParameter;
    }

    /**
     * Gets the value of the any property.
     * 
     * <p>
     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a <CODE>set</CODE> method for the any property.
     * 
     * <p>
     * For example, to add a new item, do as follows:
     * <pre>
     *    getAny().add(newItem);
     * </pre>
     * 
     * 
     * <p>
     * Objects of the following type(s) are allowed in the list
     * {@link Object }
     * {@link Element }
     * 
     * 
     */
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T05:43:54+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
    public List<Object> getAny() {
        if (any == null) {
            any = new ArrayList<Object>();
        }
        return this.any;
    }

    /**
     * Gets the value of the name property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T05:43:54+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
    public String getName() {
        return name;
    }

    /**
     * Sets the value of the name property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T05:43:54+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
    public void setName(String value) {
        this.name = value;
    }

    /**
     * Gets the value of the headTemplate property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T05:43:54+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
    public String getHeadTemplate() {
        return headTemplate;
    }

    /**
     * Sets the value of the headTemplate property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T05:43:54+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
    public void setHeadTemplate(String value) {
        this.headTemplate = value;
    }

    /**
     * Gets the value of the tailTemplate property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T05:43:54+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
    public String getTailTemplate() {
        return tailTemplate;
    }

    /**
     * Sets the value of the tailTemplate property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T05:43:54+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
    public void setTailTemplate(String value) {
        this.tailTemplate = value;
    }

    /**
     * Gets the value of the indentationLevel property.
     * 
     * @return
     *     possible object is
     *     {@link Integer }
     *     
     */
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T05:43:54+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
    public int getIndentationLevel() {
        if (indentationLevel == null) {
            return  0;
        } else {
            return indentationLevel;
        }
    }

    /**
     * Sets the value of the indentationLevel property.
     * 
     * @param value
     *     allowed object is
     *     {@link Integer }
     *     
     */
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T05:43:54+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
    public void setIndentationLevel(Integer value) {
        this.indentationLevel = value;
    }

    /**
     * Gets the value of the optional property.
     * 
     * @return
     *     possible object is
     *     {@link Boolean }
     *     
     */
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T05:43:54+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
    public boolean isOptional() {
        if (optional == null) {
            return false;
        } else {
            return optional;
        }
    }

    /**
     * Sets the value of the optional property.
     * 
     * @param value
     *     allowed object is
     *     {@link Boolean }
     *     
     */
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T05:43:54+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
    public void setOptional(Boolean value) {
        this.optional = value;
    }

    /**
     * Gets the value of the editable property.
     * 
     * @return
     *     possible object is
     *     {@link Boolean }
     *     
     */
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T05:43:54+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
    public boolean isEditable() {
        if (editable == null) {
            return false;
        } else {
            return editable;
        }
    }

    /**
     * Sets the value of the editable property.
     * 
     * @param value
     *     allowed object is
     *     {@link Boolean }
     *     
     */
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T05:43:54+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
    public void setEditable(Boolean value) {
        this.editable = value;
    }

    /**
     * Copies all values of property {@code TemplateParameter} deeply.
     * 
     * @param source
     *     The source to copy from.
     * @param target
     *     The target to copy {@code source} to.
     * @throws NullPointerException
     *     if {@code target} is {@code null}.
     */
    @SuppressWarnings("unchecked")
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T05:43:54+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
    private static void copyTemplateParameter(final List<TemplateParameterType> source, final List<TemplateParameterType> target) {
        // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000
        if ((source!= null)&&(!source.isEmpty())) {
            for (final Iterator<?> it = source.iterator(); it.hasNext(); ) {
                final Object next = it.next();
                if (next instanceof TemplateParameterType) {
                    // CClassInfo: org.jomc.tools.model.TemplateParameterType
                    target.add(((TemplateParameterType) next).clone());
                    continue;
                }
                // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/
                throw new AssertionError((("Unexpected instance '"+ next)+"' for property 'TemplateParameter' of class 'org.jomc.tools.model.SourceSectionType'."));
            }
        }
    }

    /**
     * Copies all values of property {@code Any} deeply.
     * 
     * @param source
     *     The source to copy from.
     * @param target
     *     The target to copy {@code source} to.
     * @throws NullPointerException
     *     if {@code target} is {@code null}.
     */
    @SuppressWarnings("unchecked")
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T05:43:54+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
    private static void copyAny(final List<Object> source, final List<Object> target) {
        // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000
        if ((source!= null)&&(!source.isEmpty())) {
            for (final Iterator<?> it = source.iterator(); it.hasNext(); ) {
                final Object next = it.next();
                if (next instanceof Element) {
                    // CWildcardTypeInfo: org.w3c.dom.Element
                    target.add(((Element)((Element) next).cloneNode(true)));
                    continue;
                }
                if (next instanceof Object) {
                    // CBuiltinLeafInfo: java.lang.Object
                    target.add(copyOf(((Object) next)));
                    continue;
                }
                // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/
                throw new AssertionError((("Unexpected instance '"+ next)+"' for property 'Any' of class 'org.jomc.tools.model.SourceSectionType'."));
            }
        }
    }

    /**
     * Creates and returns a deep copy of a given object.
     * 
     * @param o
     *     The instance to copy or {@code null}.
     * @return
     *     A deep copy of {@code o} or {@code null} if {@code o} is {@code null}.
     */
    @SuppressWarnings("unchecked")
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T05:43:54+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
    private static Object copyOf(final Object o) {
        // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000
        try {
            if (o!= null) {
                if (o.getClass().isPrimitive()) {
                    return o;
                }
                if (o.getClass().isArray()) {
                    return copyOfArray(o);
                }
                // Immutable types.
                if (o instanceof Boolean) {
                    return o;
                }
                if (o instanceof Byte) {
                    return o;
                }
                if (o instanceof Character) {
                    return o;
                }
                if (o instanceof Double) {
                    return o;
                }
                if (o instanceof Enum) {
                    return o;
                }
                if (o instanceof Float) {
                    return o;
                }
                if (o instanceof Integer) {
                    return o;
                }
                if (o instanceof Long) {
                    return o;
                }
                if (o instanceof Short) {
                    return o;
                }
                if (o instanceof String) {
                    return o;
                }
                if (o instanceof BigDecimal) {
                    return o;
                }
                if (o instanceof BigInteger) {
                    return o;
                }
                if (o instanceof UUID) {
                    return o;
                }
                if (o instanceof QName) {
                    return o;
                }
                if (o instanceof Duration) {
                    return o;
                }
                if (o instanceof Currency) {
                    return o;
                }
                // String based types.
                if (o instanceof File) {
                    return new File(o.toString());
                }
                if (o instanceof URI) {
                    return new URI(o.toString());
                }
                if (o instanceof URL) {
                    return new URL(o.toString());
                }
                if (o instanceof MimeType) {
                    return new MimeType(o.toString());
                }
                // Cloneable types.
                if (o instanceof XMLGregorianCalendar) {
                    return ((XMLGregorianCalendar) o).clone();
                }
                if (o instanceof Date) {
                    return ((Date) o).clone();
                }
                if (o instanceof Calendar) {
                    return ((Calendar) o).clone();
                }
                if (o instanceof TimeZone) {
                    return ((TimeZone) o).clone();
                }
                if (o instanceof Locale) {
                    return ((Locale) o).clone();
                }
                if (o instanceof Element) {
                    return ((Element)((Element) o).cloneNode(true));
                }
                if (o instanceof JAXBElement) {
                    return copyOf(((JAXBElement) o));
                }
                try {
                    return o.getClass().getMethod("clone", ((Class[]) null)).invoke(o, ((Object[]) null));
                } catch (NoSuchMethodException e) {
                    if (o instanceof Serializable) {
                        return copyOf(((Serializable) o));
                    }
                    // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/
                    throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
                } catch (IllegalAccessException e) {
                    // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/
                    throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
                } catch (InvocationTargetException e) {
                    // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/
                    throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
                } catch (SecurityException e) {
                    // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/
                    throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
                } catch (IllegalArgumentException e) {
                    // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/
                    throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
                } catch (ExceptionInInitializerError e) {
                    // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/
                    throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
                }
            }
            return null;
        } catch (MimeTypeParseException e) {
            throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
        } catch (MalformedURLException e) {
            throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
        } catch (URISyntaxException e) {
            throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
        }
    }

    /**
     * Creates and returns a deep copy of a given array.
     * 
     * @param array
     *     The array to copy or {@code null}.
     * @return
     *     A deep copy of {@code array} or {@code null} if {@code array} is {@code null}.
     */
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T05:43:54+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
    private static Object copyOfArray(final Object array) {
        // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000
        if (array!= null) {
            if (array.getClass() == boolean[].class) {
                return copyOf(((boolean[]) array));
            }
            if (array.getClass() == byte[].class) {
                return copyOf(((byte[]) array));
            }
            if (array.getClass() == char[].class) {
                return copyOf(((char[]) array));
            }
            if (array.getClass() == double[].class) {
                return copyOf(((double[]) array));
            }
            if (array.getClass() == float[].class) {
                return copyOf(((float[]) array));
            }
            if (array.getClass() == int[].class) {
                return copyOf(((int[]) array));
            }
            if (array.getClass() == long[].class) {
                return copyOf(((long[]) array));
            }
            if (array.getClass() == short[].class) {
                return copyOf(((short[]) array));
            }
            final int len = Array.getLength(array);
            final Object copy = Array.newInstance(array.getClass().getComponentType(), len);
            for (int i = (len- 1); (i >= 0); i--) {
                Array.set(copy, i, copyOf(Array.get(array, i)));
            }
            return copy;
        }
        return null;
    }

    /**
     * Creates and returns a deep copy of a given array.
     * 
     * @param array
     *     The array to copy or {@code null}.
     * @return
     *     A deep copy of {@code array} or {@code null} if {@code array} is {@code null}.
     */
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T05:43:54+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
    private static boolean[] copyOf(final boolean[] array) {
        // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000
        if (array!= null) {
            final boolean[] copy = ((boolean[]) Array.newInstance(array.getClass().getComponentType(), array.length));
            System.arraycopy(array, 0, copy, 0, array.length);
            return copy;
        }
        return null;
    }

    /**
     * Creates and returns a deep copy of a given array.
     * 
     * @param array
     *     The array to copy or {@code null}.
     * @return
     *     A deep copy of {@code array} or {@code null} if {@code array} is {@code null}.
     */
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T05:43:54+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
    private static byte[] copyOf(final byte[] array) {
        // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000
        if (array!= null) {
            final byte[] copy = ((byte[]) Array.newInstance(array.getClass().getComponentType(), array.length));
            System.arraycopy(array, 0, copy, 0, array.length);
            return copy;
        }
        return null;
    }

    /**
     * Creates and returns a deep copy of a given array.
     * 
     * @param array
     *     The array to copy or {@code null}.
     * @return
     *     A deep copy of {@code array} or {@code null} if {@code array} is {@code null}.
     */
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T05:43:54+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
    private static char[] copyOf(final char[] array) {
        // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000
        if (array!= null) {
            final char[] copy = ((char[]) Array.newInstance(array.getClass().getComponentType(), array.length));
            System.arraycopy(array, 0, copy, 0, array.length);
            return copy;
        }
        return null;
    }

    /**
     * Creates and returns a deep copy of a given array.
     * 
     * @param array
     *     The array to copy or {@code null}.
     * @return
     *     A deep copy of {@code array} or {@code null} if {@code array} is {@code null}.
     */
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T05:43:54+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
    private static double[] copyOf(final double[] array) {
        // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000
        if (array!= null) {
            final double[] copy = ((double[]) Array.newInstance(array.getClass().getComponentType(), array.length));
            System.arraycopy(array, 0, copy, 0, array.length);
            return copy;
        }
        return null;
    }

    /**
     * Creates and returns a deep copy of a given array.
     * 
     * @param array
     *     The array to copy or {@code null}.
     * @return
     *     A deep copy of {@code array} or {@code null} if {@code array} is {@code null}.
     */
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T05:43:54+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
    private static float[] copyOf(final float[] array) {
        // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000
        if (array!= null) {
            final float[] copy = ((float[]) Array.newInstance(array.getClass().getComponentType(), array.length));
            System.arraycopy(array, 0, copy, 0, array.length);
            return copy;
        }
        return null;
    }

    /**
     * Creates and returns a deep copy of a given array.
     * 
     * @param array
     *     The array to copy or {@code null}.
     * @return
     *     A deep copy of {@code array} or {@code null} if {@code array} is {@code null}.
     */
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T05:43:54+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
    private static int[] copyOf(final int[] array) {
        // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000
        if (array!= null) {
            final int[] copy = ((int[]) Array.newInstance(array.getClass().getComponentType(), array.length));
            System.arraycopy(array, 0, copy, 0, array.length);
            return copy;
        }
        return null;
    }

    /**
     * Creates and returns a deep copy of a given array.
     * 
     * @param array
     *     The array to copy or {@code null}.
     * @return
     *     A deep copy of {@code array} or {@code null} if {@code array} is {@code null}.
     */
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T05:43:54+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
    private static long[] copyOf(final long[] array) {
        // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000
        if (array!= null) {
            final long[] copy = ((long[]) Array.newInstance(array.getClass().getComponentType(), array.length));
            System.arraycopy(array, 0, copy, 0, array.length);
            return copy;
        }
        return null;
    }

    /**
     * Creates and returns a deep copy of a given array.
     * 
     * @param array
     *     The array to copy or {@code null}.
     * @return
     *     A deep copy of {@code array} or {@code null} if {@code array} is {@code null}.
     */
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T05:43:54+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
    private static short[] copyOf(final short[] array) {
        // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000
        if (array!= null) {
            final short[] copy = ((short[]) Array.newInstance(array.getClass().getComponentType(), array.length));
            System.arraycopy(array, 0, copy, 0, array.length);
            return copy;
        }
        return null;
    }

    /**
     * Creates and returns a deep copy of a given {@code JAXBElement} instance.
     * 
     * @param element
     *     The instance to copy or {@code null}.
     * @return
     *     A deep copy of {@code element} or {@code null} if {@code element} is {@code null}.
     */
    @SuppressWarnings("unchecked")
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T05:43:54+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
    private static JAXBElement copyOf(final JAXBElement element) {
        // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000
        if (element!= null) {
            final JAXBElement copy = new JAXBElement(element.getName(), element.getDeclaredType(), element.getScope(), element.getValue());
            copy.setNil(element.isNil());
            copy.setValue(copyOf(copy.getValue()));
            return copy;
        }
        return null;
    }

    /**
     * Creates and returns a deep copy of a given {@code Serializable}.
     * 
     * @param serializable
     *     The instance to copy or {@code null}.
     * @return
     *     A deep copy of {@code serializable} or {@code null} if {@code serializable} is {@code null}.
     */
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T05:43:54+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
    private static Serializable copyOf(final Serializable serializable) {
        // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000
        if (serializable!= null) {
            try {
                final ByteArrayOutputStream byteArrayOutput = new ByteArrayOutputStream();
                final ObjectOutputStream out = new ObjectOutputStream(byteArrayOutput);
                out.writeObject(serializable);
                out.close();
                final ByteArrayInputStream byteArrayInput = new ByteArrayInputStream(byteArrayOutput.toByteArray());
                final ObjectInputStream in = new ObjectInputStream(byteArrayInput);
                final Serializable copy = ((Serializable) in.readObject());
                in.close();
                return copy;
            } catch (SecurityException e) {
                throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e));
            } catch (ClassNotFoundException e) {
                throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e));
            } catch (InvalidClassException e) {
                throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e));
            } catch (NotSerializableException e) {
                throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e));
            } catch (StreamCorruptedException e) {
                throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e));
            } catch (OptionalDataException e) {
                throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e));
            } catch (IOException e) {
                throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e));
            }
        }
        return null;
    }

    /**
     * Creates and returns a deep copy of this object.
     * 
     * 
     * @return
     *     A deep copy of this object.
     */
    @Override
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T05:43:54+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
    public SourceSectionType clone() {
        {
            // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000
            final SourceSectionType clone = ((SourceSectionType) super.clone());
            // CClassInfo: org.jomc.tools.model.SourceSectionsType
            clone.sourceSections = ((this.sourceSections == null)?null:((this.getSourceSections() == null)?null:this.getSourceSections().clone()));
            // 'TemplateParameter' collection.
            if (this.templateParameter!= null) {
                clone.templateParameter = null;
                copyTemplateParameter(this.getTemplateParameter(), clone.getTemplateParameter());
            }
            // 'Any' collection.
            if (this.any!= null) {
                clone.any = null;
                copyAny(this.getAny(), clone.getAny());
            }
            // CBuiltinLeafInfo: java.lang.String
            clone.name = ((this.name == null)?null:this.getName());
            // CBuiltinLeafInfo: java.lang.String
            clone.headTemplate = ((this.headTemplate == null)?null:this.getHeadTemplate());
            // CBuiltinLeafInfo: java.lang.String
            clone.tailTemplate = ((this.tailTemplate == null)?null:this.getTailTemplate());
            // CBuiltinLeafInfo: java.lang.Integer
            clone.indentationLevel = ((this.indentationLevel == null)?null:this.getIndentationLevel());
            // CBuiltinLeafInfo: java.lang.Boolean
            clone.optional = ((this.optional == null)?null:this.isOptional());
            // CBuiltinLeafInfo: java.lang.Boolean
            clone.editable = ((this.editable == null)?null:this.isEditable());
            return clone;
        }
    }
    
    /**
     * Gets a single {@code JAXBElement} matching a namespace URI and local part from the {@code any} property of the
     * instance.
     *
     * @param namespaceURI The namespace URI of the {@code JAXBElement} to return.
     * @param localPart The local part of the {@code JAXBElement} to return.
     * @param type The class of the type the element is bound to.
     * @param <T> The type the element is bound to.
     *
     * @return The {@code JAXBElement} matching {@code namespaceURI} and {@code localPart} from the {@code any} property
     * of the instance or {@code null}, if no such element is found.
     *
     * @throws NullPointerException if {@code namespaceURI}, {@code localPart} or {@code type} is {@code null}.
     * @throws IllegalStateException if the {@code any} property contains more than one matching element.
     *
     * @see #getAnyElement(java.util.List, java.lang.String, java.lang.String, java.lang.Class)
     */
    public <T> javax.xml.bind.JAXBElement<T> getAnyElement( final String namespaceURI, final String localPart,
                                                            final Class<T> type )
    {
        return this.getAnyElement( this.getAny(), namespaceURI, localPart, type );
    }

    /**
     * Gets a list containing all {@code JAXBElement}s matching a namespace URI and local part from the {@code any}
     * property of the instance.
     *
     * @param namespaceURI The namespace URI of the {@code JAXBElement}s to return.
     * @param localPart The local part of the {@code JAXBElement}s to return.
     * @param type The class of the type the elements are bound to.
     * @param <T> The type the elements are bound to.
     *
     * @return An unmodifiable list of all {@code JAXBElement}s matching {@code namespaceURI} and {@code localPart} from
     * the {@code any} property of the instance - an empty list if no such elements are found.
     *
     * @throws NullPointerException if {@code namespaceURI}, {@code localPart} or {@code type} is {@code null}.
     *
     * @see #getAnyElements(java.util.List, java.lang.String, java.lang.String, java.lang.Class)
     */
    public <T> java.util.List<javax.xml.bind.JAXBElement<T>> getAnyElements( final String namespaceURI,
                                                                             final String localPart,
                                                                             final Class<T> type )
    {
        return this.getAnyElements( this.getAny(), namespaceURI, localPart, type );
    }

    /**
     * Gets a single object matching a given class from the {@code any} property of the instance.
     *
     * @param clazz The class to return an instance of.
     * @param <T> The type of the object to return.
     *
     * @return The instance of {@code clazz} from the {@code any} property of the instance or {@code null}, if no such
     * instance is found.
     *
     * @throws NullPointerException if {@code clazz} is {@code null}.
     * @throws IllegalStateException if the {@code any} property contains more than one matching object.
     *
     * @see #getAnyObject(java.util.List, java.lang.Class)
     */
    public <T> T getAnyObject( final Class<T> clazz )
    {
        return this.getAnyObject( this.getAny(), clazz );
    }

    /**
     * Gets a list containing all objects matching a given class from the {@code any} property of the instance.
     *
     * @param clazz The class to return all instances of.
     * @param <T> The type of the objects to return.
     *
     * @return An unmodifiable list of all instances of {@code clazz} from the {@code any} property of the instance -
     * an empty list if no such objects are found.
     *
     * @throws NullPointerException if {@code clazz} is {@code null}.
     *
     * @see #getAnyObjects(java.util.List, java.lang.Class)
     */
    public <T> java.util.List<T> getAnyObjects( final Class<T> clazz )
    {
        return this.getAnyObjects( this.getAny(), clazz );
    }

    /**
     * Gets a template parameter for a given name from the list of template parameters.
     *
     * @param name The name of the template parameter to return.
     *
     * @return The first matching template parameter or {@code null}, if no such template parameter is found.
     *
     * @throws NullPointerException if {@code name} is {@code null}.
     *
     * @see #getTemplateParameter()
     * @see TemplateParameterType#getName()
     * @since 1.6
     */
    public TemplateParameterType getTemplateParameter( final String name )
    {
        if ( name == null )
        {
            throw new NullPointerException( "name" );
        }

        for ( int i = 0, s0 = this.getTemplateParameter().size(); i < s0; i++ )
        {
            final TemplateParameterType t = this.getTemplateParameter().get( i );

            if ( name.equals( t.getName() ) )
            {
                return t;
            }
        }

        return null;
    }
      
}