1 *java.lang.Enum* *Enum* This is the common base class of all Java language enume
3 public abstract class Enum<E extends java.lang.Enum<E>>
4 extends |java.lang.Object|
5 implements |java.lang.Comparable|
8 |java.lang.Enum_Description|
9 |java.lang.Enum_Fields|
10 |java.lang.Enum_Constructors|
11 |java.lang.Enum_Methods|
13 ================================================================================
15 *java.lang.Enum_Constructors*
16 |java.lang.Enum(String,int)|Sole constructor.
18 *java.lang.Enum_Methods*
19 |java.lang.Enum.clone()|Throws CloneNotSupportedException.
20 |java.lang.Enum.compareTo(E)|Compares this enum with the specified object for o
21 |java.lang.Enum.equals(Object)|Returns true if the specified object is equal to
22 |java.lang.Enum.finalize()|enum classes cannot have finalize methods.
23 |java.lang.Enum.getDeclaringClass()|Returns the Class object corresponding to t
24 |java.lang.Enum.hashCode()|Returns a hash code for this enum constant.
25 |java.lang.Enum.name()|Returns the name of this enum constant, exactly as decla
26 |java.lang.Enum.ordinal()|Returns the ordinal of this enumeration constant (its
27 |java.lang.Enum.toString()|Returns the name of this enum constant, as contained
28 |java.lang.Enum.valueOf(Class<T>,String)|Returns the enum constant of the speci
30 *java.lang.Enum_Description*
32 This is the common base class of all Java language enumeration types.
36 *java.lang.Enum(String,int)*
39 java.lang.String name,
42 Sole constructor. Programmers cannot invoke this constructor. It is for use by
43 code emitted by the compiler in response to enum type declarations.
45 name - - The name of this enum constant, which is the identifier used to declare it.
46 ordinal - - The ordinal of this enumeration constant (its position in the enum
47 declaration, where the initial constant is assigned an ordinal of zero).
49 *java.lang.Enum.clone()*
51 protected final |java.lang.Object| clone()
52 throws |java.lang.CloneNotSupportedException|
54 Throws CloneNotSupportedException. This guarantees that enums are never cloned,
55 which is necessary to preserve their "singleton" status.
59 Returns: (never returns)
61 *java.lang.Enum.compareTo(E)*
63 public final int compareTo(E extends java.lang.Enum<E> o)
65 Compares this enum with the specified object for order. Returns a negative
66 integer, zero, or a positive integer as this object is less than, equal to, or
67 greater than the specified object.
69 Enum constants are only comparable to other enum constants of the same enum
70 type. The natural order implemented by this method is the order in which the
71 constants are declared.
75 *java.lang.Enum.equals(Object)*
77 public final boolean equals(java.lang.Object other)
79 Returns true if the specified object is equal to this enum constant.
82 other - the object to be compared for equality with this object.
84 Returns: true if the specified object is equal to this enum constant.
86 *java.lang.Enum.finalize()*
88 protected final void finalize()
90 enum classes cannot have finalize methods.
94 *java.lang.Enum.getDeclaringClass()*
96 public final |java.lang.Class|<E extends java.lang.Enum<E>> getDeclaringClass()
98 Returns the Class object corresponding to this enum constant's enum type. Two
99 enum constants e1 and e2 are of the same enum type if and only if
100 e1.getDeclaringClass() == e2.getDeclaringClass(). (The value returned by this
101 method may differ from the one returned by the (|java.lang.Object|) method for
102 enum constants with constant-specific class bodies.)
106 Returns: the Class object corresponding to this enum constant's enum type
108 *java.lang.Enum.hashCode()*
110 public final int hashCode()
112 Returns a hash code for this enum constant.
116 Returns: a hash code for this enum constant.
118 *java.lang.Enum.name()*
120 public final |java.lang.String| name()
122 Returns the name of this enum constant, exactly as declared in its enum
125 Most programmers should use the (|java.lang.Enum|) method in preference to this
126 one, as the toString method may return a more user-friendly name. This method
127 is designed primarily for use in specialized situations where correctness
128 depends on getting the exact name, which will not vary from release to release.
132 Returns: the name of this enum constant
134 *java.lang.Enum.ordinal()*
136 public final int ordinal()
138 Returns the ordinal of this enumeration constant (its position in its enum
139 declaration, where the initial constant is assigned an ordinal of zero).
141 Most programmers will have no use for this method. It is designed for use by
142 sophisticated enum-based data structures, such as (|java.util.EnumSet|) and
143 (|java.util.EnumMap|) .
147 Returns: the ordinal of this enumeration constant
149 *java.lang.Enum.toString()*
151 public |java.lang.String| toString()
153 Returns the name of this enum constant, as contained in the declaration. This
154 method may be overridden, though it typically isn't necessary or desirable. An
155 enum type should override this method when a more "programmer-friendly" string
160 Returns: the name of this enum constant
162 *java.lang.Enum.valueOf(Class<T>,String)*
164 public static |T| valueOf(
165 java.lang.Class<T> enumType,
166 java.lang.String name)
168 Returns the enum constant of the specified enum type with the specified name.
169 The name must match exactly an identifier used to declare an enum constant in
170 this type. (Extraneous whitespace characters are not permitted.)
173 enumType - the Class object of the enum type from which to return a constant
174 name - the name of the constant to return
176 Returns: the enum constant of the specified enum type with the specified name