6548433: (enum spec) java.lang.Enum docs should explain about values() and valueOf(String)
authordarcy
Tue, 03 Feb 2009 16:29:32 -0800
changeset 1948 5c23ac167e12
parent 1947 316d79a73e74
child 1949 7c24abe3d444
6548433: (enum spec) java.lang.Enum docs should explain about values() and valueOf(String) Reviewed-by: martin
jdk/src/share/classes/java/lang/Enum.java
--- a/jdk/src/share/classes/java/lang/Enum.java	Tue Feb 03 09:38:31 2009 +0800
+++ b/jdk/src/share/classes/java/lang/Enum.java	Tue Feb 03 16:29:32 2009 -0800
@@ -34,11 +34,13 @@
 /**
  * This is the common base class of all Java language enumeration types.
  *
- * More information about enums, including implicit methods synthesised
- * by the compiler, can be found in <i>The Java&trade; Language
- * Specification, Third Edition</i>, <a
+ * More information about enums, including descriptions of the
+ * implicitly declared methods synthesized by the compiler, can be
+ * found in <i>The Java&trade; Language Specification, Third
+ * Edition</i>, <a
  * href="http://java.sun.com/docs/books/jls/third_edition/html/classes.html#8.9">&sect;8.9</a>.
  *
+ * @param <E> The enum type subclass
  * @author  Josh Bloch
  * @author  Neal Gafter
  * @see     Class#getEnumConstants()
@@ -197,6 +199,15 @@
      * to declare an enum constant in this type.  (Extraneous whitespace
      * characters are not permitted.)
      *
+     * <p>Note that for a particular enum type {@code T}, the
+     * implicitly declared {@code public static T valueOf(String)}
+     * method on that enum may be used instead of this method to map
+     * from a name to the corresponding enum constant.  All the
+     * constants of an enum type can be obtained by calling the
+     * implicit {@code public static T[] values()} method of that
+     * type.
+     *
+     * @param <T> The enum type whose constant is to be returned
      * @param enumType the {@code Class} object of the enum type from which
      *      to return a constant
      * @param name the name of the constant to return