java.lang.Object | |
↳ | java.lang.Enum<E extends java.lang.Enum<E>> |
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.
Protected Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Constructor for constants of enum subtypes.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Compares this object to the specified enum object to determine their
relative order.
| |||||||||||
Compares this object with the specified object and indicates if they are
equal.
| |||||||||||
Returns the enum constant's declaring class.
| |||||||||||
Returns an integer hash code for this object.
| |||||||||||
Returns the name of this enum constant.
| |||||||||||
Returns the position of the enum constant in the declaration.
| |||||||||||
Returns a string containing a concise, human-readable description of this
object.
| |||||||||||
Returns the constant with the specified name of the specified enum type.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Enum objects are singletons, they may not be cloned. |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class java.lang.Object
| |||||||||||
From interface java.lang.Comparable
|
Constructor for constants of enum subtypes.
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. |
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.
o | the enum object to compare this object to. |
---|
o
; 0 if the ordinal
values of this enum constant and o
are equal; a positive
value if the ordinal value of this enum constant is greater than
the ordinal value of o
.Compares this object with the specified object and indicates if they are
equal. In order to be equal, object
must be identical to this
enum constant.
other | the object to compare this enum constant with. |
---|
true
if the specified object is equal to this
Enum
; false
otherwise.
Returns the enum constant's declaring class.
Returns an integer hash code for this object. By contract, any two
objects for which equals(Object)
returns true
must return
the same hash code value. This means that subclasses of Object
usually override both methods or neither method.
Returns the name of this enum constant. The name is the field as it
appears in the enum
declaration.
Returns the position of the enum constant in the declaration. The first constant has an ordinal value of zero.
Returns a string containing a concise, human-readable description of this object. In this case, the enum constant's name is returned.
Returns the constant with the specified name of the specified enum type.
enumType | the class of the enumerated type to search for the constant value. |
---|---|
name | the name of the constant value to find. |
NullPointerException | if either enumType or name are null . |
---|---|
IllegalArgumentException | if enumType is not an enumerated type or does not
have a constant value called name .
|
Enum
objects are singletons, they may not be cloned. This method
always throws a CloneNotSupportedException
.
CloneNotSupportedException | is always thrown. |
---|