/*
 * XML Type:  DefinitionsType
 * Namespace: http://docs.oasis-open.org/wsrf/2004/10/wsrf-WSResourceMetadataDescriptor-1.0-draft-01.xsd
 * Java type: org.activemq.ws.xmlbeans.resource.md.DefinitionsType
 *
 * Automatically generated - do not modify.
 */
package org.activemq.ws.xmlbeans.resource.md.impl;
/**
 * An XML DefinitionsType(@http://docs.oasis-open.org/wsrf/2004/10/wsrf-WSResourceMetadataDescriptor-1.0-draft-01.xsd).
 *
 * This is a complex type.
 */
public class DefinitionsTypeImpl extends org.activemq.ws.xmlbeans.resource.md.impl.DocumentedTypeImpl implements org.activemq.ws.xmlbeans.resource.md.DefinitionsType
{
    
    public DefinitionsTypeImpl(org.apache.xmlbeans.SchemaType sType)
    {
        super(sType);
    }
    
    private static final javax.xml.namespace.QName METADATADESCRIPTOR$0 = 
        new javax.xml.namespace.QName("http://docs.oasis-open.org/wsrf/2004/10/wsrf-WSResourceMetadataDescriptor-1.0-draft-01.xsd", "MetadataDescriptor");
    private static final javax.xml.namespace.QName TARGETNAMESPACE$2 = 
        new javax.xml.namespace.QName("", "targetNamespace");
    
    
    /**
     * Gets array of all "MetadataDescriptor" elements
     */
    public org.activemq.ws.xmlbeans.resource.md.MetadataDescriptorType[] getMetadataDescriptorArray()
    {
        synchronized (monitor())
        {
            check_orphaned();
            java.util.List targetList = new java.util.ArrayList();
            get_store().find_all_element_users(METADATADESCRIPTOR$0, targetList);
            org.activemq.ws.xmlbeans.resource.md.MetadataDescriptorType[] result = new org.activemq.ws.xmlbeans.resource.md.MetadataDescriptorType[targetList.size()];
            targetList.toArray(result);
            return result;
        }
    }
    
    /**
     * Gets ith "MetadataDescriptor" element
     */
    public org.activemq.ws.xmlbeans.resource.md.MetadataDescriptorType getMetadataDescriptorArray(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.activemq.ws.xmlbeans.resource.md.MetadataDescriptorType target = null;
            target = (org.activemq.ws.xmlbeans.resource.md.MetadataDescriptorType)get_store().find_element_user(METADATADESCRIPTOR$0, i);
            if (target == null)
            {
                throw new IndexOutOfBoundsException();
            }
            return target;
        }
    }
    
    /**
     * Returns number of "MetadataDescriptor" element
     */
    public int sizeOfMetadataDescriptorArray()
    {
        synchronized (monitor())
        {
            check_orphaned();
            return get_store().count_elements(METADATADESCRIPTOR$0);
        }
    }
    
    /**
     * Sets array of all "MetadataDescriptor" element
     */
    public void setMetadataDescriptorArray(org.activemq.ws.xmlbeans.resource.md.MetadataDescriptorType[] metadataDescriptorArray)
    {
        synchronized (monitor())
        {
            check_orphaned();
            arraySetterHelper(metadataDescriptorArray, METADATADESCRIPTOR$0);
        }
    }
    
    /**
     * Sets ith "MetadataDescriptor" element
     */
    public void setMetadataDescriptorArray(int i, org.activemq.ws.xmlbeans.resource.md.MetadataDescriptorType metadataDescriptor)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.activemq.ws.xmlbeans.resource.md.MetadataDescriptorType target = null;
            target = (org.activemq.ws.xmlbeans.resource.md.MetadataDescriptorType)get_store().find_element_user(METADATADESCRIPTOR$0, i);
            if (target == null)
            {
                throw new IndexOutOfBoundsException();
            }
            target.set(metadataDescriptor);
        }
    }
    
    /**
     * Inserts and returns a new empty value (as xml) as the ith "MetadataDescriptor" element
     */
    public org.activemq.ws.xmlbeans.resource.md.MetadataDescriptorType insertNewMetadataDescriptor(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.activemq.ws.xmlbeans.resource.md.MetadataDescriptorType target = null;
            target = (org.activemq.ws.xmlbeans.resource.md.MetadataDescriptorType)get_store().insert_element_user(METADATADESCRIPTOR$0, i);
            return target;
        }
    }
    
    /**
     * Appends and returns a new empty value (as xml) as the last "MetadataDescriptor" element
     */
    public org.activemq.ws.xmlbeans.resource.md.MetadataDescriptorType addNewMetadataDescriptor()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.activemq.ws.xmlbeans.resource.md.MetadataDescriptorType target = null;
            target = (org.activemq.ws.xmlbeans.resource.md.MetadataDescriptorType)get_store().add_element_user(METADATADESCRIPTOR$0);
            return target;
        }
    }
    
    /**
     * Removes the ith "MetadataDescriptor" element
     */
    public void removeMetadataDescriptor(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            get_store().remove_element(METADATADESCRIPTOR$0, i);
        }
    }
    
    /**
     * Gets the "targetNamespace" attribute
     */
    public java.lang.String getTargetNamespace()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(TARGETNAMESPACE$2);
            if (target == null)
            {
                return null;
            }
            return target.getStringValue();
        }
    }
    
    /**
     * Gets (as xml) the "targetNamespace" attribute
     */
    public org.apache.xmlbeans.XmlAnyURI xgetTargetNamespace()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlAnyURI target = null;
            target = (org.apache.xmlbeans.XmlAnyURI)get_store().find_attribute_user(TARGETNAMESPACE$2);
            return target;
        }
    }
    
    /**
     * Sets the "targetNamespace" attribute
     */
    public void setTargetNamespace(java.lang.String targetNamespace)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(TARGETNAMESPACE$2);
            if (target == null)
            {
                target = (org.apache.xmlbeans.SimpleValue)get_store().add_attribute_user(TARGETNAMESPACE$2);
            }
            target.setStringValue(targetNamespace);
        }
    }
    
    /**
     * Sets (as xml) the "targetNamespace" attribute
     */
    public void xsetTargetNamespace(org.apache.xmlbeans.XmlAnyURI targetNamespace)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlAnyURI target = null;
            target = (org.apache.xmlbeans.XmlAnyURI)get_store().find_attribute_user(TARGETNAMESPACE$2);
            if (target == null)
            {
                target = (org.apache.xmlbeans.XmlAnyURI)get_store().add_attribute_user(TARGETNAMESPACE$2);
            }
            target.set(targetNamespace);
        }
    }
}
