Class Item<T>

    • Constructor Detail

      • Item

        public Item()
    • Method Detail

      • setClassFile

        public void setClassFile​(ClassFile classFile)
        Binds this item to the class file that owns its pool.
        Parameters:
        classFile - the owning class file
      • read

        public abstract void read​(ClassFile classFile)
        Reads the constant pool item from the class file.
        Parameters:
        classFile - The ClassFile utility to read data.
      • write

        public abstract void write​(DataOutputStream dos)
                            throws IOException
        Writes the item to the output stream (excluding the tag byte, which is written by the caller).
        Parameters:
        dos - The output stream to write to.
        Throws:
        IOException - If an I/O error occurs.
      • getType

        public abstract byte getType()
        Returns the type of the constant pool item.
        Returns:
        The constant pool tag.
      • getValue

        public abstract T getValue()
        Returns the value held by the constant pool item.
        Returns:
        The value of type T.
      • accept

        public void accept​(AbstractClassVisitor visitor)
        Accepts a visitor for the visitor pattern.
        Parameters:
        visitor - The visitor to accept.
      • getIndex

        public int getIndex​(ConstPool constPool)
        Gets the index of this item in the constant pool.
        Parameters:
        constPool - The constant pool to search.
        Returns:
        The index of this item.