Class Xref


  • public class Xref
    extends Object
    An immutable cross-reference from a source instruction to the class, method, or field it names.
    • Method Detail

      • getSourceClass

        public String getSourceClass()
        Returns:
        the source class
      • getSourceMethod

        public String getSourceMethod()
        Returns:
        the source method
      • getSourceMethodDesc

        public String getSourceMethodDesc()
        Returns:
        the source method desc
      • getLineNumber

        public int getLineNumber()
        Returns:
        the line number
      • getInstructionIndex

        public int getInstructionIndex()
        Returns:
        the instruction index
      • getBytecodeOffset

        public int getBytecodeOffset()
        Returns:
        the bytecode offset
      • getTargetClass

        public String getTargetClass()
        Returns:
        the target class
      • getTargetMember

        public String getTargetMember()
        Returns:
        the target member
      • getTargetDescriptor

        public String getTargetDescriptor()
        Returns:
        the target descriptor
      • getType

        public XrefType getType()
        Returns:
        the type
      • isMethodRef

        public boolean isMethodRef()
        Tests whether the reference names a specific method.
        Returns:
        true if a member was recorded and the type is a method reference
      • isFieldRef

        public boolean isFieldRef()
        Tests whether the reference names a specific field.
        Returns:
        true if a member was recorded and the type is a field reference
      • isClassRef

        public boolean isClassRef()
        Tests whether the reference names a class rather than a specific member.
        Returns:
        true if the type is a type reference or no member was recorded
      • getSourceMethodRef

        public MethodReference getSourceMethodRef()
        Packages the source class, method name and descriptor as a method reference.
        Returns:
        the enclosing method reference
      • getTargetMethodRef

        public MethodReference getTargetMethodRef()
        Packages the target class, member and descriptor as a method reference.
        Returns:
        the target method reference, or null if this is not a method reference
      • getTargetFieldRef

        public FieldReference getTargetFieldRef()
        Packages the target class, member and descriptor as a field reference.
        Returns:
        the target field reference, or null if this is not a field reference
      • getSourceDisplay

        public String getSourceDisplay()
        Renders the source as a dotted class name, optionally with method and line suffixes.
        Returns:
        the display string
      • getTargetDisplay

        public String getTargetDisplay()
        Renders the target as a dotted class name plus member, with "()" appended for method refs.
        Returns:
        the display string
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • builder

        public static Xref.Builder builder()
        Returns:
        a fresh builder with an empty source and target and type METHOD_CALL