package ibilling.classifiers;
 
public class BillingCycleClassifier 
    implements java.io.Serializable, iapp.services.Classifier {
 
    public static final BillingCycleClassifier WEEKLY = new BillingCycleClassifier("W");
    public static final BillingCycleClassifier MONTHLY = new BillingCycleClassifier("M");
    public static final BillingCycleClassifier QUARTERLY = new BillingCycleClassifier("Q");
    public static final BillingCycleClassifier SEMI_ANNUALLY = new BillingCycleClassifier("S");
    public static final BillingCycleClassifier ANNUALLY = new BillingCycleClassifier("A");
    public static final BillingCycleClassifier BI_WEEKLY = new BillingCycleClassifier("B");
    public static final BillingCycleClassifier BI_WEEKLY = new BillingCycleClassifier("B");
    public static final BillingCycleClassifier BI_WEEKLY = new BillingCycleClassifier("B");
 
    private static final java.util.Map values = new java.util.TreeMap();
    private static java.util.List literals = new java.util.ArrayList(3);
    private static java.util.List names = new java.util.ArrayList(3);
 
    /**
     * Initializes the values.
     */
    static {
        values.put(WEEKLY.value, WEEKLY);
	literals.add(WEEKLY.value);
	WEEKLY.setName("WEEKLY");
        names.add("WEEKLY");
        values.put(MONTHLY.value, MONTHLY);
	literals.add(MONTHLY.value);
	MONTHLY.setName("MONTHLY");
        names.add("MONTHLY");
        values.put(QUARTERLY.value, QUARTERLY);
	literals.add(QUARTERLY.value);
	QUARTERLY.setName("QUARTERLY");
        names.add("QUARTERLY");
        values.put(SEMI_ANNUALLY.value, SEMI_ANNUALLY);
	literals.add(SEMI_ANNUALLY.value);
	SEMI_ANNUALLY.setName("SEMI_ANNUALLY");
        names.add("SEMI_ANNUALLY");
        values.put(ANNUALLY.value, ANNUALLY);
	literals.add(ANNUALLY.value);
	ANNUALLY.setName("ANNUALLY");
        names.add("ANNUALLY");
        values.put(BI_WEEKLY.value, BI_WEEKLY);
	literals.add(BI_WEEKLY.value);
	BI_WEEKLY.setName("BI_WEEKLY");
        names.add("BI_WEEKLY");
        values.put(BI_WEEKLY.value, BI_WEEKLY);
	literals.add(BI_WEEKLY.value);
	BI_WEEKLY.setName("BI_WEEKLY");
        names.add("BI_WEEKLY");
        values.put(BI_WEEKLY.value, BI_WEEKLY);
	literals.add(BI_WEEKLY.value);
	BI_WEEKLY.setName("BI_WEEKLY");
        names.add("BI_WEEKLY");
        literals = java.util.Collections.unmodifiableList(literals);
        names = java.util.Collections.unmodifiableList(names);
    }
 
	private java.lang.String value;
	private java.lang.String name;
 
	/**
     * The default constructor allowing super classes to access it.
     */
    protected BillingCycleClassifier() {}
 
    private BillingCycleClassifier(java.lang.String value) {
        this.value = value;
    }
 
	public String toString() {
        return java.lang.String.valueOf(value);
    }
 
    /**
     * Creates an instance of BillingCycleClassifier from <code>value</code>.
     *
     * @param value the value to create the BillingCycleClassifier from.
     */
    public static BillingCycleClassifier fromString(java.lang.String value) {
        if(value == null) return null;
		final BillingCycleClassifier typeValue = (BillingCycleClassifier) values.get(value);
        if (typeValue == null) {
            throw new IllegalArgumentException("invalid value '" + value + "', possible values are: " + literals);
        }
        return typeValue;
    }
 
	/**
	* Checks correct value for the classifier
	*/
	public boolean isBillingCycleClassifier(java.lang.String value){
	  return (value == null || values.get(value) != null);
	}
    /**
     * Get/set for value
     */
    public java.lang.String getValue() {
        return this.value;
    }
    public java.lang.String getName() {
        return this.name;
    }
    /**
     * Get/set for name
     */
    private void setName(java.lang.String name) {
        this.name = name;
    }
    /**
     * @see java.lang.Comparable#compareTo(java.lang.Object)
     */
    public int compareTo(Object that)
    {
        return (this == that) ? 0 : this.getValue().compareTo(((BillingCycleClassifier)that).getValue());
    }
 
    public static java.util.Map getValues() {
        return values;
    }
 
    /**
     * Returns an unmodifiable list containing the literals that are known by this enumeration.
     *
     * @return A List containing the actual literals defined by this enumeration, this list
     *         can not be modified.
     */
    public static java.util.List literals() {
        return literals;
    }
 
    /**
     * Returns an unmodifiable list containing the names of the literals that are known
     * by this enumeration.
     *
     * @return A List containing the actual names of the literals defined by this
     *         enumeration, this list can not be modified.
     */
    public static java.util.List names() {
        return names;
    }
 
    /**
     * @see java.lang.Object#equals(java.lang.Object)
     */
    public boolean equals(Object object) {
        return (this == object)
            || (object instanceof BillingCycleClassifier && ((BillingCycleClassifier)object).getValue().equals(
                this.getValue()));
    }
 
    /**
     * @see java.lang.Object#hashCode()
     */
    public int hashCode() {
        return this.getValue().hashCode();
    }
 
    /**
     * This method allows the deserialization of an instance of this enumeration type to return the actual instance
     * that will be the singleton for the JVM in which the current thread is running.
     * <p/>
     * Doing this will allow users to safely use the equality operator <code>==</code> for enumerations because
     * a regular deserialized object is always a newly constructed instance and will therefore never be
     * an existing reference; it is this <code>readResolve()</code> method which will intercept the deserialization
     * process in order to return the proper singleton reference.
     */
    private java.lang.Object readResolve() throws java.io.ObjectStreamException {
        return BillingCycleClassifier.fromString(this.value);
    }
 
}