Class NameAndTypeRefItem


  • public class NameAndTypeRefItem
    extends Item<NameAndType>
    A CONSTANT_NameAndType constant pool entry, holding the name and descriptor indices of a member.
    • Constructor Detail

      • NameAndTypeRefItem

        public NameAndTypeRefItem()
    • Method Detail

      • getConstPool

        public ConstPool getConstPool()
        Returns:
        the const pool
      • setConstPool

        public void setConstPool​(ConstPool constPool)
        Binds the pool used to resolve the name and descriptor indices.
        Parameters:
        constPool - the owning constant pool
      • setValue

        public void setValue​(NameAndType value)
        Replaces the name and descriptor index pair this entry holds.
        Parameters:
        value - the new pair
      • 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<NameAndType>
        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<NameAndType>
        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<NameAndType>
        Returns:
        The constant pool tag.
      • getValue

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

        public String getDescriptor()
        Resolves the descriptor string through the bound constant pool.
        Returns:
        the descriptor string
        Throws:
        IllegalStateException - if no pool is bound or the descriptor index is unresolvable
      • getName

        public String getName()
        Resolves the name string through the bound constant pool.
        Returns:
        the name string
        Throws:
        IllegalStateException - if no pool is bound or the name index is unresolvable
      • setNameIndex

        public void setNameIndex​(int nameIndex)
        Repoints this entry at a different name.
        Parameters:
        nameIndex - the constant pool index of the new name
      • setDescIndex

        public void setDescIndex​(int descIndex)
        Repoints this entry at a different descriptor.
        Parameters:
        descIndex - the constant pool index of the new descriptor