27
28 import java.io.IOException;
29 import java.io.InvalidObjectException;
30 import java.io.ObjectInputStream;
31 import java.io.ObjectStreamException;
32 import java.io.Serializable;
33 import java.lang.constant.ClassDesc;
34 import java.lang.constant.Constable;
35 import java.lang.constant.ConstantDescs;
36 import java.lang.constant.DynamicConstantDesc;
37 import java.lang.invoke.MethodHandles;
38 import java.util.Optional;
39
40 import static java.util.Objects.requireNonNull;
41
42 /**
43 * This is the common base class of all Java language enumeration types.
44 *
45 * More information about enums, including descriptions of the
46 * implicitly declared methods synthesized by the compiler, can be
47 * found in section 8.9 of
48 * <cite>The Java™ Language Specification</cite>.
49 *
50 * Enumeration types are all serializable and receive special handling
51 * by the serialization mechanism. The serialized representation used
52 * for enum constants cannot be customized. Declarations of methods
53 * and fields that would otherwise interact with serialization are
54 * ignored, including {@code serialVersionUID}; see the <cite>Java
55 * Object Serialization Specification</cite> for details.
56 *
57 * <p> Note that when using an enumeration type as the type of a set
58 * or as the type of the keys in a map, specialized and efficient
59 * {@linkplain java.util.EnumSet set} and {@linkplain
60 * java.util.EnumMap map} implementations are available.
61 *
62 * @param <E> The enum type subclass
63 * @serial exclude
64 * @author Josh Bloch
65 * @author Neal Gafter
66 * @see Class#getEnumConstants()
67 * @see java.util.EnumSet
|
27
28 import java.io.IOException;
29 import java.io.InvalidObjectException;
30 import java.io.ObjectInputStream;
31 import java.io.ObjectStreamException;
32 import java.io.Serializable;
33 import java.lang.constant.ClassDesc;
34 import java.lang.constant.Constable;
35 import java.lang.constant.ConstantDescs;
36 import java.lang.constant.DynamicConstantDesc;
37 import java.lang.invoke.MethodHandles;
38 import java.util.Optional;
39
40 import static java.util.Objects.requireNonNull;
41
42 /**
43 * This is the common base class of all Java language enumeration types.
44 *
45 * More information about enums, including descriptions of the
46 * implicitly declared methods synthesized by the compiler, can be
47 * found in section {@jls 8.9} of
48 * <cite>The Java™ Language Specification</cite>.
49 *
50 * Enumeration types are all serializable and receive special handling
51 * by the serialization mechanism. The serialized representation used
52 * for enum constants cannot be customized. Declarations of methods
53 * and fields that would otherwise interact with serialization are
54 * ignored, including {@code serialVersionUID}; see the <cite>Java
55 * Object Serialization Specification</cite> for details.
56 *
57 * <p> Note that when using an enumeration type as the type of a set
58 * or as the type of the keys in a map, specialized and efficient
59 * {@linkplain java.util.EnumSet set} and {@linkplain
60 * java.util.EnumMap map} implementations are available.
61 *
62 * @param <E> The enum type subclass
63 * @serial exclude
64 * @author Josh Bloch
65 * @author Neal Gafter
66 * @see Class#getEnumConstants()
67 * @see java.util.EnumSet
|