| java.lang.Object javolution.lang.Enum
Enum | abstract public class Enum implements Comparable,Serializable(Code) | | This class is equivalent to java.lang.Enum
and is moved (refactored) to the java.lang system
package for applications targetting the J2SE 5.0+ run-time.
This is a clean-room implementation of the Enum base class.
author: Jean-Marie Dautelle version: 2.0, November 26, 2004 |
Constructor Summary | |
protected | Enum(String name, int ordinal) Enum's base constructor. |
Method Summary | |
final public int | compareTo(Object that) Compares the position of two enum from the same enumeration. | final public boolean | equals(Object that) Indicates if two enums are equals. | final public Class | getDeclaringClass() Returns this enum's class. | final public int | hashCode() Returns the enums' hashcode. | final public String | name() Returns the name of this enum. | final public int | ordinal() Returns the position of this enum in the enumeration (starting
at 0 ). | public String | toString() Returns the String representation of this enum. | public static Enum | valueOf(Class enumType, String name) Returns the enum from the specified enum's class with the specified
name.
Parameters: enumType - the enum's declaring class. Parameters: name - the name of the enum to return. |
Enum | protected Enum(String name, int ordinal)(Code) | | Enum's base constructor.
Parameters: name - the enum's name. Parameters: ordinal - the enum's position. |
compareTo | final public int compareTo(Object that)(Code) | | Compares the position of two enum from the same enumeration.
Parameters: that - the enum to be compared with. a negative value, zero, or a positive value as this enum is less than, equal to, or greater than the specified enum. throws: ClassCastException - if both enum do not belong to the sameenumeration. |
equals | final public boolean equals(Object that)(Code) | | Indicates if two enums are equals.
Parameters: that - the enum to be compared for equality. this == that |
getDeclaringClass | final public Class getDeclaringClass()(Code) | | Returns this enum's class.
this.getClass() |
hashCode | final public int hashCode()(Code) | | Returns the enums' hashcode.
System.identityHashCode(this) |
name | final public String name()(Code) | | Returns the name of this enum.
the enum's name. |
ordinal | final public int ordinal()(Code) | | Returns the position of this enum in the enumeration (starting
at 0 ).
the enum's position. |
toString | public String toString()(Code) | | Returns the String representation of this enum.
the enum's name. |
valueOf | public static Enum valueOf(Class enumType, String name)(Code) | | Returns the enum from the specified enum's class with the specified
name.
Parameters: enumType - the enum's declaring class. Parameters: name - the name of the enum to return. the corresponding enum. throws: IllegalArgumentException - if the enum does not exist. |
|
|