Class Xref.Builder

  • Enclosing class:
    Xref

    public static class Xref.Builder
    extends Object
    Mutable accumulator for the fields of an Xref.
    • Constructor Detail

      • Builder

        public Builder()
    • Method Detail

      • sourceClass

        public Xref.Builder sourceClass​(String sourceClass)
        Sets the class the reference occurs in.
        Parameters:
        sourceClass - the referencing class
        Returns:
        this builder
      • sourceMethod

        public Xref.Builder sourceMethod​(String name,
                                         String desc)
        Sets the method the reference occurs in.
        Parameters:
        name - the method name
        desc - the method descriptor
        Returns:
        this builder
      • lineNumber

        public Xref.Builder lineNumber​(int lineNumber)
        Sets the source line the reference was attributed to.
        Parameters:
        lineNumber - the line number, or -1 if unknown
        Returns:
        this builder
      • instructionIndex

        public Xref.Builder instructionIndex​(int index)
        Sets the index of the referencing instruction within the method.
        Parameters:
        index - the instruction index, or -1 if unknown
        Returns:
        this builder
      • bytecodeOffset

        public Xref.Builder bytecodeOffset​(int offset)
        Sets the bytecode offset of the referencing instruction.
        Parameters:
        offset - the offset, or -1 if unknown
        Returns:
        this builder
      • targetClass

        public Xref.Builder targetClass​(String targetClass)
        Sets the referenced class.
        Parameters:
        targetClass - the class being referenced
        Returns:
        this builder
      • targetMember

        public Xref.Builder targetMember​(String name,
                                         String desc)
        Sets the referenced member, leaving the target class untouched.
        Parameters:
        name - the member name
        desc - the member descriptor
        Returns:
        this builder
      • targetMethod

        public Xref.Builder targetMethod​(String owner,
                                         String name,
                                         String desc)
        Sets the target class and member from a method reference.
        Parameters:
        owner - the declaring class
        name - the method name
        desc - the method descriptor
        Returns:
        this builder
      • targetField

        public Xref.Builder targetField​(String owner,
                                        String name,
                                        String desc)
        Sets the target class and member from a field reference.
        Parameters:
        owner - the declaring class
        name - the field name
        desc - the field descriptor
        Returns:
        this builder
      • type

        public Xref.Builder type​(XrefType type)
        Sets the kind of reference; defaults to METHOD_CALL.
        Parameters:
        type - the reference kind
        Returns:
        this builder
      • build

        public Xref build()
        Returns:
        an immutable cross-reference holding the accumulated values