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

/**
 * The possible control types of field
 * 
 * @version $Revision$ $Date$
 */
public class ControlSType implements java.io.Serializable {


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

    /**
     * The entity type
     */
    public static final int ENTITY_TYPE = 0;

    /**
     * The instance of the entity type
     */
    public static final ControlSType ENTITY = new ControlSType(ENTITY_TYPE, "entity");

    /**
     * The edit type
     */
    public static final int EDIT_TYPE = 1;

    /**
     * The instance of the edit type
     */
    public static final ControlSType EDIT = new ControlSType(EDIT_TYPE, "edit");

    /**
     * The textarea type
     */
    public static final int TEXTAREA_TYPE = 2;

    /**
     * The instance of the textarea type
     */
    public static final ControlSType TEXTAREA = new ControlSType(TEXTAREA_TYPE, "textarea");

    /**
     * The select type
     */
    public static final int SELECT_TYPE = 3;

    /**
     * The instance of the select type
     */
    public static final ControlSType SELECT = new ControlSType(SELECT_TYPE, "select");

    /**
     * The checkbox type
     */
    public static final int CHECKBOX_TYPE = 4;

    /**
     * The instance of the checkbox type
     */
    public static final ControlSType CHECKBOX = new ControlSType(CHECKBOX_TYPE, "checkbox");

    /**
     * The calendar type
     */
    public static final int CALENDAR_TYPE = 5;

    /**
     * The instance of the calendar type
     */
    public static final ControlSType CALENDAR = new ControlSType(CALENDAR_TYPE, "calendar");

    /**
     * The memo type
     */
    public static final int MEMO_TYPE = 6;

    /**
     * The instance of the memo type
     */
    public static final ControlSType MEMO = new ControlSType(MEMO_TYPE, "memo");

    /**
     * The link type
     */
    public static final int LINK_TYPE = 7;

    /**
     * The instance of the link type
     */
    public static final ControlSType LINK = new ControlSType(LINK_TYPE, "link");

    /**
     * The m2m type
     */
    public static final int M2M_TYPE = 8;

    /**
     * The instance of the m2m type
     */
    public static final ControlSType M2M = new ControlSType(M2M_TYPE, "m2m");

    /**
     * The grid type
     */
    public static final int GRID_TYPE = 9;

    /**
     * The instance of the grid type
     */
    public static final ControlSType GRID = new ControlSType(GRID_TYPE, "grid");

    /**
     * The inline_memo type
     */
    public static final int INLINE_MEMO_TYPE = 10;

    /**
     * The instance of the inline_memo type
     */
    public static final ControlSType INLINE_MEMO = new ControlSType(INLINE_MEMO_TYPE, "inline_memo");

    /**
     * The history type
     */
    public static final int HISTORY_TYPE = 11;

    /**
     * The instance of the history type
     */
    public static final ControlSType HISTORY = new ControlSType(HISTORY_TYPE, "history");

    /**
     * The chart type
     */
    public static final int CHART_TYPE = 12;

    /**
     * The instance of the chart type
     */
    public static final ControlSType CHART = new ControlSType(CHART_TYPE, "chart");

    /**
     * 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 ControlSType(int type, java.lang.String value) 
     {
        super();
        this.type = type;
        this.stringValue = value;
    } //-- com.queplix.core.jxb.entity.types.ControlSType(int, java.lang.String)


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

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

    /**
     * Method getType
     * 
     * Returns the type of this ControlSType
     * 
     * @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("entity", ENTITY);
        members.put("edit", EDIT);
        members.put("textarea", TEXTAREA);
        members.put("select", SELECT);
        members.put("checkbox", CHECKBOX);
        members.put("calendar", CALENDAR);
        members.put("memo", MEMO);
        members.put("link", LINK);
        members.put("m2m", M2M);
        members.put("grid", GRID);
        members.put("inline_memo", INLINE_MEMO);
        members.put("history", HISTORY);
        members.put("chart", CHART);
        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 ControlSType
     * 
     * @return String
     */
    public java.lang.String toString()
    {
        return this.stringValue;
    } //-- java.lang.String toString() 

    /**
     * Method valueOf
     * 
     * Returns a new ControlSType based on the given String value.
     * 
     * @param string
     * @return ControlSType
     */
    public static com.queplix.core.jxb.entity.types.ControlSType 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 ControlSType";
            throw new IllegalArgumentException(err);
        }
        return (ControlSType) obj;
    } //-- com.queplix.core.jxb.entity.types.ControlSType valueOf(java.lang.String) 

}
