From 6a6fc9ad3fdcaae1a7c8a6795b6ccd2e03943d3b Mon Sep 17 00:00:00 2001 From: Joe Darcy Date: Tue, 3 Feb 2009 16:29:32 -0800 Subject: [PATCH] 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 | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/jdk/src/share/classes/java/lang/Enum.java b/jdk/src/share/classes/java/lang/Enum.java index e5f50f58793..5df8146c1d4 100644 --- a/jdk/src/share/classes/java/lang/Enum.java +++ b/jdk/src/share/classes/java/lang/Enum.java @@ -34,11 +34,13 @@ import java.io.ObjectStreamException; /** * 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 The Java™ Language - * Specification, Third Edition, The Java™ Language Specification, Third + * Edition, §8.9. * + * @param The enum type subclass * @author Josh Bloch * @author Neal Gafter * @see Class#getEnumConstants() @@ -197,6 +199,15 @@ public abstract class Enum> * to declare an enum constant in this type. (Extraneous whitespace * characters are not permitted.) * + *

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 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