com.sun.n1.util.enum
Class EnumImpl

java.lang.Object
  extended by com.sun.n1.util.enum.EnumImpl
All Implemented Interfaces:
Enum
Direct Known Subclasses:
EnumXImpl

public abstract class EnumImpl
extends java.lang.Object
implements Enum

This class is the base implementation of the Enumumeration types. Its not meant to be used directly, only subclasses should be used.


Constructor Summary
protected EnumImpl()
          Creates a new enumumeration without any registration.
protected EnumImpl(java.lang.String stringValue, EnumFactoryImpl factory)
          Creates a new enumumeration, and registers it with the passed factory.
 
Method Summary
 boolean equals(java.lang.Object other)
          This object is considered equal to the other object if the other object is non-null, and has the same class and int value.
 int hashCode()
          Returns the hash code of this enum.
 int toInt()
          Returns the int value of this enum.
 java.lang.String toString()
          Returns the String value of this enum.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EnumImpl

protected EnumImpl(java.lang.String stringValue,
                   EnumFactoryImpl factory)
Creates a new enumumeration, and registers it with the passed factory. The name must be unique amongst all enums currently registered with the passed factory.

Parameters:
stringValue - the name of the enum.
factory - the factory with which to register the eunm.
Throws:
java.lang.IllegalArgumentException - if the passed name is already registered within the passed factory.

EnumImpl

protected EnumImpl()
Creates a new enumumeration without any registration.

Method Detail

hashCode

public int hashCode()
Returns the hash code of this enum.

Overrides:
hashCode in class java.lang.Object
Returns:
The hash code of this enum.

equals

public boolean equals(java.lang.Object other)
This object is considered equal to the other object if the other object is non-null, and has the same class and int value.

Overrides:
equals in class java.lang.Object
Parameters:
other - the object to compare against for equality
Returns:
true if-and-only-if this object is equal to the passed object.

toInt

public int toInt()
Returns the int value of this enum.

Specified by:
toInt in interface Enum
Returns:
the enum as an int value.

toString

public java.lang.String toString()
Returns the String value of this enum.

Overrides:
toString in class java.lang.Object
Returns:
the enum as a String value.