Class MethodReference


  • public class MethodReference
    extends Object
    An immutable method identity of owner class, name, and descriptor.
    • Constructor Detail

      • MethodReference

        public MethodReference​(String owner,
                               String name,
                               String descriptor)
        Creates a new method reference.
        Parameters:
        owner - the internal name of the class that owns this method (e.g., "java/lang/String")
        name - the method name (e.g., "toString", "<init>")
        descriptor - the method descriptor (e.g., "()Ljava/lang/String;")
    • Method Detail

      • getOwner

        public String getOwner()
        Returns:
        the internal name of the owning class
      • getName

        public String getName()
        Returns:
        the method name
      • getDescriptor

        public String getDescriptor()
        Returns:
        the method descriptor
      • getFullSignature

        public String getFullSignature()
        Concatenates owner, name and descriptor into a single identifying string.
        Returns:
        the signature, such as "java/lang/String.toString()Ljava/lang/String;"
      • isConstructor

        public boolean isConstructor()
        Tests whether the name is the constructor name.
        Returns:
        true if the name is <init>
      • isStaticInitializer

        public boolean isStaticInitializer()
        Tests whether the name is the static initializer name.
        Returns:
        true if the name is <clinit>
      • getDisplayName

        public String getDisplayName()
        Renders the reference with the dotted class name and a summarized parameter list.
        Returns:
        the display string, such as "com.example.MyClass.methodName()"
      • getShortDisplayName

        public String getShortDisplayName()
        Renders the reference with the simple class name and a summarized parameter list.
        Returns:
        the short display string
      • getFullReference

        public String getFullReference()
        Returns:
        the fully qualified signature
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object