Class MethodHandleInfo


  • public final class MethodHandleInfo
    extends Object
    A CONSTANT_MethodHandle entry: reference kind plus the referenced member's owner, name, and descriptor.
    • Constructor Detail

      • MethodHandleInfo

        public MethodHandleInfo​(int referenceKind,
                                String owner,
                                String name,
                                String descriptor)
        Creates a method handle descriptor.
        Parameters:
        referenceKind - one of the REF_* kind constants
        owner - internal name of the referenced member's declaring class
        name - the referenced member's name
        descriptor - the referenced member's descriptor
    • Method Detail

      • getReferenceKind

        public int getReferenceKind()
        Returns:
        the reference kind
      • getOwner

        public String getOwner()
        Returns:
        the owner
      • getName

        public String getName()
        Returns:
        the name
      • getDescriptor

        public String getDescriptor()
        Returns:
        the descriptor
      • isFieldReference

        public boolean isFieldReference()
        Checks whether the handle references a field.
        Returns:
        true for the get/put field and static kinds
      • isMethodReference

        public boolean isMethodReference()
        Checks whether the handle references a method or constructor.
        Returns:
        true for the invoke kinds
      • isGetter

        public boolean isGetter()
        Checks whether the handle reads a field.
        Returns:
        true for REF_getField or REF_getStatic
      • isSetter

        public boolean isSetter()
        Checks whether the handle writes a field.
        Returns:
        true for REF_putField or REF_putStatic
      • isStatic

        public boolean isStatic()
        Checks whether the referenced member is static.
        Returns:
        true for the static field kinds or REF_invokeStatic
      • isConstructor

        public boolean isConstructor()
        Checks whether the handle invokes a constructor.
        Returns:
        true for REF_newInvokeSpecial
      • getReferenceKindName

        public String getReferenceKindName()
        Names the reference kind for diagnostics.
        Returns:
        the REF_* constant name, or a placeholder for unknown kinds