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

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

import java.io.Serializable;
import java.util.Enumeration;
import java.util.Hashtable;
import org.exolab.castor.xml.Marshaller;
import org.exolab.castor.xml.Unmarshaller;

/**
 * Class PermissionsType.
 * 
 * @version $Revision$ $Date$
 */
public class PermissionsType implements java.io.Serializable {


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

    /**
     * The read type
     */
    public static final int READ_TYPE = 0;

    /**
     * The instance of the read type
     */
    public static final PermissionsType READ = new PermissionsType(READ_TYPE, "read");

    /**
     * The write type
     */
    public static final int WRITE_TYPE = 1;

    /**
     * The instance of the write type
     */
    public static final PermissionsType WRITE = new PermissionsType(WRITE_TYPE, "write");

    /**
     * The owner type
     */
    public static final int OWNER_TYPE = 2;

    /**
     * The instance of the owner type
     */
    public static final PermissionsType OWNER = new PermissionsType(OWNER_TYPE, "owner");

    /**
     * The fullcontrol type
     */
    public static final int FULLCONTROL_TYPE = 3;

    /**
     * The instance of the fullcontrol type
     */
    public static final PermissionsType FULLCONTROL = new PermissionsType(FULLCONTROL_TYPE, "fullcontrol");

    /**
     * Field _memberTable
     */
    private static java.util.Hashtable _memberTable = init();

    /**
     * Field type
     */
    private int type = -1;

    /**
     * Field stringValue
     */
    private java.lang.String stringValue = null;


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

    private PermissionsType(int type, java.lang.String value) 
     {
        super();
        this.type = type;
        this.stringValue = value;
    } //-- com.queplix.core.modules.config.jxb.types.PermissionsType(int, java.lang.String)


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

    /**
     * Method enumerate
     * 
     * Returns an enumeration of all possible instances of
     * PermissionsType
     * 
     * @return Enumeration
     */
    public static java.util.Enumeration enumerate()
    {
        return _memberTable.elements();
    } //-- java.util.Enumeration enumerate() 

    /**
     * Method getType
     * 
     * Returns the type of this PermissionsType
     * 
     * @return int
     */
    public int getType()
    {
        return this.type;
    } //-- int getType() 

    /**
     * Method init
     * 
     * 
     * 
     * @return Hashtable
     */
    private static java.util.Hashtable init()
    {
        Hashtable members = new Hashtable();
        members.put("read", READ);
        members.put("write", WRITE);
        members.put("owner", OWNER);
        members.put("fullcontrol", FULLCONTROL);
        return members;
    } //-- java.util.Hashtable init() 

    /**
     * Method readResolve
     * 
     *  will be called during deserialization to replace the
     * deserialized object with the correct constant instance.
     * <br/>
     * 
     * @return Object
     */
    private java.lang.Object readResolve()
    {
        return valueOf(this.stringValue);
    } //-- java.lang.Object readResolve() 

    /**
     * Method toString
     * 
     * Returns the String representation of this PermissionsType
     * 
     * @return String
     */
    public java.lang.String toString()
    {
        return this.stringValue;
    } //-- java.lang.String toString() 

    /**
     * Method valueOf
     * 
     * Returns a new PermissionsType based on the given String
     * value.
     * 
     * @param string
     * @return PermissionsType
     */
    public static com.queplix.core.modules.config.jxb.types.PermissionsType valueOf(java.lang.String string)
    {
        java.lang.Object obj = null;
        if (string != null) obj = _memberTable.get(string);
        if (obj == null) {
            String err = "'" + string + "' is not a valid PermissionsType";
            throw new IllegalArgumentException(err);
        }
        return (PermissionsType) obj;
    } //-- com.queplix.core.modules.config.jxb.types.PermissionsType valueOf(java.lang.String) 

}
