/*
 * This class was automatically generated with 
 * <a href="http://www.castor.org">Castor 0.9.7</a>, using an XML
 * Schema.
 * $Id$
 */

package com.queplix.core.modules.config.jxb.userprop;

//---------------------------------/
//- Imported classes and packages -/
//---------------------------------/

import org.exolab.castor.xml.Marshaller;
import org.exolab.castor.xml.Unmarshaller;

import java.util.ArrayList;

/**
 * Class ResUserProperties.
 *
 * @version $Revision$ $Date$
 */
public class ResUserProperties extends com.queplix.core.utils.jxb.JXBObject
        implements java.io.Serializable {

    //--------------------------/
    //- Class/Member Variables -/
    //--------------------------/

    /**
     * Field _resUserPropertyList
     */
    private java.util.ArrayList _resUserPropertyList;

    //----------------/
    //- Constructors -/
    //----------------/

    public ResUserProperties() {
        super();
        _resUserPropertyList = new ArrayList();
    } //-- com.queplix.core.modules.config.jxb.userprop.ResUserProperties()

    //-----------/
    //- Methods -/
    //-----------/

    /**
     * Method addResUserProperty
     *
     * @param vResUserProperty
     */
    public void addResUserProperty(
            com.queplix.core.modules.config.jxb.userprop.ResUserProperty vResUserProperty)
            throws java.lang.IndexOutOfBoundsException {
        _resUserPropertyList.add(vResUserProperty);
    } //-- void addResUserProperty(com.queplix.core.modules.config.jxb.userprop.ResUserProperty) 

    /**
     * Method addResUserProperty
     *
     * @param index
     * @param vResUserProperty
     */
    public void addResUserProperty(int index,
                                   com.queplix.core.modules.config.jxb.userprop.ResUserProperty vResUserProperty)
            throws java.lang.IndexOutOfBoundsException {
        _resUserPropertyList.add(index, vResUserProperty);
    } //-- void addResUserProperty(int, com.queplix.core.modules.config.jxb.userprop.ResUserProperty) 

    /**
     * Method clearResUserProperty
     */
    public void clearResUserProperty() {
        _resUserPropertyList.clear();
    } //-- void clearResUserProperty() 

    /**
     * Method enumerateResUserProperty
     *
     * @return Enumeration
     */
    public java.util.Enumeration enumerateResUserProperty() {
        return new org.exolab.castor.util.IteratorEnumeration(
                _resUserPropertyList.iterator());
    } //-- java.util.Enumeration enumerateResUserProperty() 

    /**
     * Method getResUserProperty
     *
     * @param index
     * @return ResUserProperty
     */
    public com.queplix.core.modules.config.jxb.userprop.ResUserProperty getResUserProperty(
            int index)
            throws java.lang.IndexOutOfBoundsException {
        //-- check bounds for index
        if((index < 0) || (index > _resUserPropertyList.size())) {
            throw new IndexOutOfBoundsException();
        }

        return (com.queplix.core.modules.config.jxb.userprop.ResUserProperty) _resUserPropertyList
                .get(index);
    } //-- com.queplix.core.modules.config.jxb.userprop.ResUserProperty getResUserProperty(int) 

    /**
     * Method getResUserProperty
     *
     * @return ResUserProperty
     */
    public com.queplix.core.modules.config.jxb.userprop.ResUserProperty[] getResUserProperty() {
        int size = _resUserPropertyList.size();
        com.queplix.core.modules.config.jxb.userprop.ResUserProperty[] mArray
                = new com.queplix.core.modules.config.jxb.userprop.ResUserProperty[size];
        for(int index = 0; index < size; index++) {
            mArray[index]
                    = (com.queplix.core.modules.config.jxb.userprop.ResUserProperty) _resUserPropertyList
                    .get(index);
        }
        return mArray;
    } //-- com.queplix.core.modules.config.jxb.userprop.ResUserProperty[] getResUserProperty() 

    /**
     * Method getResUserPropertyCount
     *
     * @return int
     */
    public int getResUserPropertyCount() {
        return _resUserPropertyList.size();
    } //-- int getResUserPropertyCount() 

    /**
     * Method isValid
     *
     * @return boolean
     */
    public boolean isValid() {
        try {
            validate();
        }
        catch (org.exolab.castor.xml.ValidationException vex) {
            return false;
        }
        return true;
    } //-- boolean isValid() 

    /**
     * Method marshal
     *
     * @param out
     */
    public void marshal(java.io.Writer out)
            throws org.exolab.castor.xml.MarshalException,
            org.exolab.castor.xml.ValidationException {

        Marshaller.marshal(this, out);
    } //-- void marshal(java.io.Writer) 

    /**
     * Method marshal
     *
     * @param handler
     */
    public void marshal(org.xml.sax.ContentHandler handler)
            throws java.io.IOException, org.exolab.castor.xml.MarshalException,
            org.exolab.castor.xml.ValidationException {

        Marshaller.marshal(this, handler);
    } //-- void marshal(org.xml.sax.ContentHandler) 

    /**
     * Method removeResUserProperty
     *
     * @param vResUserProperty
     * @return boolean
     */
    public boolean removeResUserProperty(
            com.queplix.core.modules.config.jxb.userprop.ResUserProperty vResUserProperty) {
        boolean removed = _resUserPropertyList.remove(vResUserProperty);
        return removed;
    } //-- boolean removeResUserProperty(com.queplix.core.modules.config.jxb.userprop.ResUserProperty) 

    /**
     * Method setResUserProperty
     *
     * @param index
     * @param vResUserProperty
     */
    public void setResUserProperty(int index,
                                   com.queplix.core.modules.config.jxb.userprop.ResUserProperty vResUserProperty)
            throws java.lang.IndexOutOfBoundsException {
        //-- check bounds for index
        if((index < 0) || (index > _resUserPropertyList.size())) {
            throw new IndexOutOfBoundsException();
        }
        _resUserPropertyList.set(index, vResUserProperty);
    } //-- void setResUserProperty(int, com.queplix.core.modules.config.jxb.userprop.ResUserProperty) 

    /**
     * Method setResUserProperty
     *
     * @param resUserPropertyArray
     */
    public void setResUserProperty(
            com.queplix.core.modules.config.jxb.userprop.ResUserProperty[] resUserPropertyArray) {
        //-- copy array
        _resUserPropertyList.clear();
        for(int i = 0; i < resUserPropertyArray.length; i++) {
            _resUserPropertyList.add(resUserPropertyArray[i]);
        }
    } //-- void setResUserProperty(com.queplix.core.modules.config.jxb.userprop.ResUserProperty) 

    /**
     * Method unmarshal
     *
     * @param reader
     * @return Object
     */
    public static java.lang.Object unmarshal(java.io.Reader reader)
            throws org.exolab.castor.xml.MarshalException,
            org.exolab.castor.xml.ValidationException {
        return (com.queplix.core.modules.config.jxb.userprop.ResUserProperties) Unmarshaller
                .unmarshal(
                        com.queplix.core.modules.config.jxb.userprop.ResUserProperties.class,
                        reader);
    } //-- java.lang.Object unmarshal(java.io.Reader) 

    /**
     * Method validate
     */
    public void validate()
            throws org.exolab.castor.xml.ValidationException {
        org.exolab.castor.xml.Validator validator
                = new org.exolab.castor.xml.Validator();
        validator.validate(this);
    } //-- void validate() 

}
