Class Enum.EnumDesc<E extends Enum<E>>

Type Parameters:
E - the type of the enum constant
All Implemented Interfaces:
ConstantDesc
Enclosing class:
Enum<E extends Enum<E>>

public static final class Enum.EnumDesc<E extends Enum<E>> extends DynamicConstantDesc<E>
A nominal descriptor for an enum constant.
Since:
12
  • Method Details

    • of

      public static <E extends Enum<E>> Enum.EnumDesc<E> of(ClassDesc enumClass, String constantName)
      Returns a nominal descriptor for the specified enum class and name
      Type Parameters:
      E - the type of the enum constant
      Parameters:
      enumClass - a ClassDesc describing the enum class
      constantName - the unqualified name of the enum constant
      Returns:
      the nominal descriptor
      Throws:
      NullPointerException - if any argument is null
      Since:
      12
    • resolveConstantDesc

      public E resolveConstantDesc(MethodHandles.Lookup lookup) throws ReflectiveOperationException
      Description copied from interface: ConstantDesc
      Resolves this descriptor reflectively, emulating the resolution behavior of JVMS and the access control behavior of JVMS . The resolution and access control context is provided by the MethodHandles.Lookup parameter. No caching of the resulting value is performed.
      Specified by:
      resolveConstantDesc in interface ConstantDesc
      Overrides:
      resolveConstantDesc in class DynamicConstantDesc<E extends Enum<E>>
      Parameters:
      lookup - The MethodHandles.Lookup to provide name resolution and access control context
      Returns:
      the resolved constant value
      Throws:
      ReflectiveOperationException - if a class, method, or field could not be reflectively resolved in the course of resolution
    • toString

      public String toString()
      Description copied from class: DynamicConstantDesc
      Returns a compact textual description of this constant description, including the bootstrap method, the constant name and type, and the static bootstrap arguments.
      Overrides:
      toString in class DynamicConstantDesc<E extends Enum<E>>
      Returns:
      A compact textual description of this call site descriptor