/*
 * 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.services.jxb;

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

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

import java.util.ArrayList;

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

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

    /**
     * The full-qualified name of java class
     */
    private java.lang.String _className;

    /**
     * The collection of add-on parameters
     */
    private java.util.ArrayList _paramList;

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

    public CacheType() {
        super();
        _paramList = new ArrayList();
    } //-- com.queplix.core.modules.services.jxb.CacheType()

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

    /**
     * Method addParam
     *
     * @param vParam
     */
    public void addParam(com.queplix.core.modules.services.jxb.Param vParam)
            throws java.lang.IndexOutOfBoundsException {
        _paramList.add(vParam);
    } //-- void addParam(com.queplix.core.modules.services.jxb.Param) 

    /**
     * Method addParam
     *
     * @param index
     * @param vParam
     */
    public void addParam(int index,
                         com.queplix.core.modules.services.jxb.Param vParam)
            throws java.lang.IndexOutOfBoundsException {
        _paramList.add(index, vParam);
    } //-- void addParam(int, com.queplix.core.modules.services.jxb.Param) 

    /**
     * Method clearParam
     */
    public void clearParam() {
        _paramList.clear();
    } //-- void clearParam() 

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

    /**
     * Returns the value of field 'className'. The field
     * 'className' has the following description: The
     * full-qualified name of java class
     *
     * @return the value of field 'className'.
     */
    public java.lang.String getClassName() {
        return this._className;
    } //-- java.lang.String getClassName() 

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

        return (com.queplix.core.modules.services.jxb.Param) _paramList.get(
                index);
    } //-- com.queplix.core.modules.services.jxb.Param getParam(int) 

    /**
     * Method getParam
     *
     * @return Param
     */
    public com.queplix.core.modules.services.jxb.Param[] getParam() {
        int size = _paramList.size();
        com.queplix.core.modules.services.jxb.Param[] mArray
                = new com.queplix.core.modules.services.jxb.Param[size];
        for(int index = 0; index < size; index++) {
            mArray[index]
                    = (com.queplix.core.modules.services.jxb.Param) _paramList
                    .get(index);
        }
        return mArray;
    } //-- com.queplix.core.modules.services.jxb.Param[] getParam() 

    /**
     * Method getParamCount
     *
     * @return int
     */
    public int getParamCount() {
        return _paramList.size();
    } //-- int getParamCount() 

    /**
     * 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 removeParam
     *
     * @param vParam
     * @return boolean
     */
    public boolean removeParam(
            com.queplix.core.modules.services.jxb.Param vParam) {
        boolean removed = _paramList.remove(vParam);
        return removed;
    } //-- boolean removeParam(com.queplix.core.modules.services.jxb.Param) 

    /**
     * Sets the value of field 'className'. The field 'className'
     * has the following description: The full-qualified name of
     * java class
     *
     * @param className the value of field 'className'.
     */
    public void setClassName(java.lang.String className) {
        this._className = className;
    } //-- void setClassName(java.lang.String) 

    /**
     * Method setParam
     *
     * @param index
     * @param vParam
     */
    public void setParam(int index,
                         com.queplix.core.modules.services.jxb.Param vParam)
            throws java.lang.IndexOutOfBoundsException {
        //-- check bounds for index
        if((index < 0) || (index > _paramList.size())) {
            throw new IndexOutOfBoundsException();
        }
        _paramList.set(index, vParam);
    } //-- void setParam(int, com.queplix.core.modules.services.jxb.Param) 

    /**
     * Method setParam
     *
     * @param paramArray
     */
    public void setParam(
            com.queplix.core.modules.services.jxb.Param[] paramArray) {
        //-- copy array
        _paramList.clear();
        for(int i = 0; i < paramArray.length; i++) {
            _paramList.add(paramArray[i]);
        }
    } //-- void setParam(com.queplix.core.modules.services.jxb.Param) 

    /**
     * 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.services.jxb.CacheType) Unmarshaller
                .unmarshal(
                        com.queplix.core.modules.services.jxb.CacheType.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() 

}
