Class MethodRefItem


  • public class MethodRefItem
    extends Item<MethodRef>
    A CONSTANT_Methodref constant pool entry, holding the class and name-and-type indices of a class method.
    • Constructor Detail

      • MethodRefItem

        public MethodRefItem()
    • Method Detail

      • setValue

        public void setValue​(MethodRef value)
        Parameters:
        value - the method reference to hold
      • read

        public void read​(ClassFile classFile)
        Description copied from class: Item
        Reads the constant pool item from the class file.
        Specified by:
        read in class Item<MethodRef>
        Parameters:
        classFile - The ClassFile utility to read data.
      • write

        public void write​(DataOutputStream dos)
                   throws IOException
        Description copied from class: Item
        Writes the item to the output stream (excluding the tag byte, which is written by the caller).
        Specified by:
        write in class Item<MethodRef>
        Parameters:
        dos - The output stream to write to.
        Throws:
        IOException - If an I/O error occurs.
      • getType

        public byte getType()
        Description copied from class: Item
        Returns the type of the constant pool item.
        Specified by:
        getType in class Item<MethodRef>
        Returns:
        The constant pool tag.
      • getValue

        public MethodRef getValue()
        Description copied from class: Item
        Returns the value held by the constant pool item.
        Specified by:
        getValue in class Item<MethodRef>
        Returns:
        The value of type T.
      • getClassName

        public String getClassName()
        Gets the class name from constant pool.
        Returns:
        class name or null if unavailable
      • getName

        public String getName()
        Gets the method name from constant pool.
        Returns:
        method name or null if unavailable
      • getDescriptor

        public String getDescriptor()
        Gets the method descriptor from constant pool.
        Returns:
        method descriptor or null if unavailable
      • getParameterCount

        public int getParameterCount()
        Gets the number of method parameters.
        Returns:
        parameter count
        Throws:
        IllegalStateException - if classFile not set or invalid index
      • getReturnTypeSlots

        public int getReturnTypeSlots()
        Gets the number of slots for the return type.
        Returns:
        return type slot count
        Throws:
        IllegalStateException - if ConstPool not set or invalid index
      • setClassIndex

        public void setClassIndex​(int classIndex)
        Sets the class index.
        Parameters:
        classIndex - class index to set
      • setNameAndTypeIndex

        public void setNameAndTypeIndex​(int nameAndTypeIndex)
        Sets the name and type index.
        Parameters:
        nameAndTypeIndex - name and type index to set
      • getOwner

        public String getOwner()
        Gets owner class internal name from constant pool.
        Returns:
        owner class internal name or null if unavailable