serialVersionUID
; see the
Java
Object Serialization Specification for details.
Note that when using an enumeration type as the type of a set or as the type of the keys in a map, specialized and efficient set and map implementations are available.
Class#getEnumConstants()
, java.util.EnumSet
, java.util.EnumMap
Modifier and Type | Class and Description |
---|---|
public static class | Enum.
the type of the enum constant E extends EnumA nominal descriptor for an
|
Modifier and Type | Field and Description |
---|---|
private int | hash
The hash code of this enumeration constant. |
private final String | name
The name of this enum constant, as declared in the enum declaration. |
private final int | ordinal
The ordinal of this enumeration constant (its position in the enum declaration, where the initial constant is assigned an ordinal of zero). |
Access | Constructor and Description |
---|---|
protected |
Modifier and Type | Method and Description |
---|---|
protected final Object | |
public final int | compareTo(E
the object to be compared. o)Implements java. Compares this enum with the specified object for order. |
public final Optional | describeConstable()
Implements java. Returns an enum descriptor |
public final boolean | Returns: true if the specified object is equal to this enum constant.the object to be compared for equality with this object. other)Overrides java. Returns true if the specified object is equal to this enum constant. |
protected final void | finalize()
Overrides java.
Deprecated
for removal since 18. Finalization has been deprecated for removal. See
java. for background information and details
about migration options.
enum classes cannot have finalize methods. |
public final Class | Returns: the Class object corresponding to this enum constant's enum typeReturns the Class object corresponding to this enum constant's enum type. |
public final int | Returns: a hash code for this enum constant.Overrides java. Returns a hash code for this enum constant. |
public final String | Returns: the name of this enum constantReturns the name of this enum constant, exactly as declared in its enum declaration. |
public final int | Returns: the ordinal of this enumeration constantReturns the ordinal of this enumeration constant (its position in its enum declaration, where the initial constant is assigned an ordinal of zero). |
private void | |
private void | |
public String | Returns: the name of this enum constantOverrides java. Returns the name of this enum constant, as contained in the declaration. |
public static < The enum class whose constant is to be returned T extends Enum |
hash | back to summary |
---|---|
private int hash The hash code of this enumeration constant. |
name | back to summary |
---|---|
private final String name The name of this enum constant, as declared in the enum declaration.
Most programmers should use the |
ordinal | back to summary |
---|---|
private final int ordinal The ordinal of this enumeration constant (its position
in the enum declaration, where the initial constant is assigned
an ordinal of zero).
Most programmers will have no use for this field. It is designed
for use by sophisticated enum-based data structures, such as
|
Enum | back to summary |
---|---|
protected Enum(String name, int ordinal) Sole constructor. Programmers cannot invoke this constructor. It is for use by code emitted by the compiler in response to enum class declarations.
|
clone | back to summary |
---|---|
protected final Object clone() throws CloneNotSupportedException Overrides java. Throws CloneNotSupportedException. This guarantees that enums are never cloned, which is necessary to preserve their "singleton" status.
|
compareTo | back to summary |
---|---|
public final int compareTo(E o) Implements java. Compares this enum with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object. Enum constants are only comparable to other enum constants of the same enum type. The natural order implemented by this method is the order in which the constants are declared.
|
describeConstable | back to summary |
---|---|
public final Optional Implements java. Returns an enum descriptor |
equals | back to summary |
---|---|
public final boolean equals(Object other) Overrides java. Returns true if the specified object is equal to this enum constant.
|
finalize | back to summary |
---|---|
protected final void finalize() Overrides java. Deprecated for removal since 18. Finalization has been deprecated for removal. See
enum classes cannot have finalize methods.
|
getDeclaringClass | back to summary |
---|---|
public final Class Returns the Class object corresponding to this enum constant's
enum type. Two enum constants e1 and e2 are of the
same enum type if and only if
e1.getDeclaringClass() == e2.getDeclaringClass().
(The value returned by this method may differ from the one returned
by the
|
hashCode | back to summary |
---|---|
public final int hashCode() Overrides java. Returns a hash code for this enum constant.
|
name | back to summary |
---|---|
public final String name() Returns the name of this enum constant, exactly as declared in its
enum declaration.
Most programmers should use the
|
ordinal | back to summary |
---|---|
public final int ordinal() Returns the ordinal of this enumeration constant (its position
in its enum declaration, where the initial constant is assigned
an ordinal of zero).
Most programmers will have no use for this method. It is
designed for use by sophisticated enum-based data structures, such
as
|
readObject | back to summary |
---|---|
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException prevent default deserialization
|
readObjectNoData | back to summary |
---|---|
private void readObjectNoData() throws ObjectStreamException
|
toString | back to summary |
---|---|
public String toString() Overrides java. Returns the name of this enum constant, as contained in the declaration. This method may be overridden, though it typically isn't necessary or desirable. An enum class should override this method when a more "programmer-friendly" string form exists.
|
valueOf | back to summary |
---|---|
public static <T extends Enum Returns the enum constant of the specified enum class with the specified name. The name must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.) Note that for a particular enum class
|
enum
constant.
Access | Constructor and Description |
---|---|
private |
Modifier and Type | Method and Description |
---|---|
public static < the type of the enum constant E extends Enum | |
public E | resolveConstantDesc(MethodHandles.
The lookupMethodHandles. to provide name resolution
and access control contextOverrides java. Implements java. Resolves this descriptor reflectively, emulating the resolution behavior of JVMS 5.4.3 and the access control behavior of JVMS 5.4.4. |
public String | toString()
Overrides java. Returns a compact textual description of this constant description, including the bootstrap method, the constant name and type, and the static bootstrap arguments. |
EnumDesc | back to summary |
---|---|
private EnumDesc(ClassDesc constantClass, String constantName) Constructs a nominal descriptor for the specified
|
of | back to summary |
---|---|
public static <E extends Enum Returns a nominal descriptor for the specified
|
resolveConstantDesc | back to summary |
---|---|
public E resolveConstantDesc(MethodHandles. Overrides java. Implements java. Doc from java. Resolves this descriptor reflectively, emulating the resolution behavior
of JVMS 5.4.3 and the access control behavior of JVMS 5.4.4. The resolution
and access control context is provided by the
|
toString | back to summary |
---|---|
public String toString() Overrides java. Doc from java. Returns a compact textual description of this constant description, including the bootstrap method, the constant name and type, and the static bootstrap arguments. |