|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.lang.Enum<T>
public abstract class Enum<T extends Enum<T>>
This class represents a Java enumeration. All enumerations are subclasses of this class.
| Constructor Summary | |
|---|---|
protected |
Enum(String name,
int ordinal)
This constructor is used by the compiler to create enumeration constants. |
| Method Summary | ||
|---|---|---|
protected Object |
clone()
Cloning of enumeration constants is prevented, to maintain their singleton status. |
|
int |
compareTo(T e)
Returns an integer which represents the relative ordering of this enumeration constant. |
|
boolean |
equals(Object o)
Returns true if this enumeration is equivalent to the supplied object, o. |
|
protected void |
finalize()
Enumerations can not have finalization methods. |
|
Class<T> |
getDeclaringClass()
Returns the type of this enumeration constant. |
|
int |
hashCode()
Returns the hash code of this constant. |
|
String |
name()
Returns the name of this enumeration constant. |
|
int |
ordinal()
Returns the number of this enumeration constant, which represents the order in which it was originally declared, starting from zero. |
|
String |
toString()
Returns a textual representation of this enumeration constant. |
|
static
|
valueOf(Class<S> etype,
String s)
Returns an Enum for a enum class given a description string of the enum constant. |
|
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
protected Enum(String name,
int ordinal)
name - the name of the enumeration constant.ordinal - the number of the enumeration constant, based on the
declaration order of the constants and starting from zero.| Method Detail |
|---|
public static <S extends Enum<S>> S valueOf(Class<S> etype,
String s)
NullPointerException - when etype or s are null.
IllegalArgumentException - when there is no value s in
the enum etype.public final boolean equals(Object o)
o. Only one instance of an enumeration constant exists,
so the comparison is simply done using ==.
equals in class Objecto - the object to compare to this.
this == o.Object.hashCode()public final int hashCode()
hashCode in class ObjectObject.equals(Object),
System.identityHashCode(Object)public String toString()
toString in class ObjectObject.getClass(),
Object.hashCode(),
Class.getName(),
Integer.toHexString(int)public final int compareTo(T e)
compareTo in interface Comparable<T extends Enum<T>>e - the enumeration constant to compare.
e.ordinal < this.ordinal,
zero if e.ordinal == this.ordinal and a positive
integer if e.ordinal > this.ordinal.
ClassCastException - if e is not an enumeration
constant of the same class.
protected final Object clone()
throws CloneNotSupportedException
clone in class ObjectCloneNotSupportedException - as enumeration constants can't be
cloned.Cloneablepublic final String name()
public final int ordinal()
public final Class<T> getDeclaringClass()
protected final void finalize()
finalize in class ObjectSystem.gc(),
System.runFinalizersOnExit(boolean),
java.lang.ref
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||