Save This Page
Home » apache-harmony-6.0-src-r917296-snapshot » java » lang » [javadoc | source]
java.lang
abstract public class: Enum [javadoc | source]
java.lang.Object
   java.lang.Enum

All Implemented Interfaces:
    Comparable, Serializable

The superclass of all enumerated types. Actual enumeration types inherit from this class, but extending this class does not make a class an enumeration type, since the compiler needs to generate special information for it.
Constructor:
 protected Enum(String name,
    int ordinal) 
    Constructor for constants of enum subtypes.
    Parameters:
    name - the enum constant's declared name.
    ordinal - the enum constant's ordinal, which corresponds to its position in the enum declaration, starting at zero.
Method from java.lang.Enum Summary:
clone,   compareTo,   equals,   finalize,   getDeclaringClass,   getValues,   hashCode,   name,   ordinal,   toString,   valueOf
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from java.lang.Enum Detail:
 protected final Object clone() throws CloneNotSupportedException 
    {@code Enum} objects are singletons, they may not be cloned. This method always throws a {@code CloneNotSupportedException}.
 public final int compareTo(E o) 
    Compares this object to the specified enum object to determine their relative order. This method compares the object's ordinal values, that is, their position in the enum declaration.
 public final boolean equals(Object other) 
    Compares this object with the specified object and indicates if they are equal. In order to be equal, {@code object} must be identical to this enum constant.
 protected final  void finalize() 
    All enum classes should not have finalize methods.
 public final Class<E> getDeclaringClass() 
    Returns the enum constant's declaring class.
 static T[] getValues(Class<T> enumType) 
 public final int hashCode() 
 public final String name() 
    Returns the name of this enum constant. The name is the field as it appears in the {@code enum} declaration.
 public final int ordinal() 
    Returns the position of the enum constant in the declaration. The first constant has an ordinal value of zero.
 public String toString() 
    Returns a string containing a concise, human-readable description of this object. In this case, the enum constant's name is returned.
 public static T valueOf(Class<T> enumType,
    String name) 
    Returns the constant with the specified name of the specified enum type.