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

package nz.co.cks.tms.xml.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;

/**
 * CKS TMS NCB Address Types
 * 
 * @version $Revision$ $Date$
 */
public class NcbAddressTypeType implements java.io.Serializable {


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

    /**
     * The Delivery type
     */
    public static final int DELIVERY_TYPE = 0;

    /**
     * The instance of the Delivery type
     */
    public static final NcbAddressTypeType DELIVERY = new NcbAddressTypeType(DELIVERY_TYPE, "Delivery");

    /**
     * The Billing type
     */
    public static final int BILLING_TYPE = 1;

    /**
     * The instance of the Billing type
     */
    public static final NcbAddressTypeType BILLING = new NcbAddressTypeType(BILLING_TYPE, "Billing");

    /**
     * The Receipt type
     */
    public static final int RECEIPT_TYPE = 2;

    /**
     * The instance of the Receipt type
     */
    public static final NcbAddressTypeType RECEIPT = new NcbAddressTypeType(RECEIPT_TYPE, "Receipt");

    /**
     * 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 NcbAddressTypeType(int type, java.lang.String value) {
        super();
        this.type = type;
        this.stringValue = value;
    } //-- nz.co.cks.tms.xml.types.NcbAddressTypeType(int, java.lang.String)


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

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

    /**
     * Method getTypeReturns the type of this NcbAddressTypeType
     */
    public int getType()
    {
        return this.type;
    } //-- int getType() 

    /**
     * Method init
     */
    private static java.util.Hashtable init()
    {
        Hashtable members = new Hashtable();
        members.put("Delivery", DELIVERY);
        members.put("Billing", BILLING);
        members.put("Receipt", RECEIPT);
        return members;
    } //-- java.util.Hashtable init() 

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

    /**
     * Method valueOfReturns a new NcbAddressTypeType based on the
     * given String value.
     * 
     * @param string
     */
    public static nz.co.cks.tms.xml.types.NcbAddressTypeType 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 NcbAddressTypeType";
            throw new IllegalArgumentException(err);
        }
        return (NcbAddressTypeType) obj;
    } //-- nz.co.cks.tms.xml.types.NcbAddressTypeType valueOf(java.lang.String) 

}
