Class InnerClass

  • All Implemented Interfaces:
    java.lang.Cloneable, Node

    public final class InnerClass
    extends java.lang.Object
    implements java.lang.Cloneable, Node
    This class represents a inner class attribute, that is, the class indices of the inner and outer classes, the name and the attributes of the inner class.
    See Also:
    InnerClasses
    • Constructor Summary

      Constructors 
      Constructor Description
      InnerClass​(int innerClassIndex, int outerClassIndex, int innerNameIndex, int innerAccessFlags)
      Constructs an InnerClass.
      InnerClass​(java.io.DataInput file)
      Constructs object from file stream.
      InnerClass​(InnerClass c)
      Initialize from another object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void accept​(Visitor v)
      Called by objects that are traversing the nodes of the tree implicitly defined by the contents of a Java class.
      InnerClass copy()
      Creates a deep copy of this object.
      void dump​(java.io.DataOutputStream file)
      Dumps inner class attribute to file stream in binary format.
      int getInnerAccessFlags()
      Gets the access flags of inner class.
      int getInnerClassIndex()
      Gets the class index of inner class.
      int getInnerNameIndex()
      Gets the name index of inner class.
      int getOuterClassIndex()
      Gets the class index of outer class.
      void setInnerAccessFlags​(int innerAccessFlags)
      Sets the access flags for this inner class.
      void setInnerClassIndex​(int innerClassIndex)
      Sets the index into the constant pool for this class.
      void setInnerNameIndex​(int innerNameIndex)
      Sets the index into the constant pool for this class's name.
      void setOuterClassIndex​(int outerClassIndex)
      Sets the index into the constant pool for the owning class.
      java.lang.String toString()
      Gets the string representation.
      java.lang.String toString​(ConstantPool constantPool)
      Gets the resolved string representation.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • innerClassIndex

        private int innerClassIndex
      • outerClassIndex

        private int outerClassIndex
      • innerNameIndex

        private int innerNameIndex
      • innerAccessFlags

        private int innerAccessFlags
    • Constructor Detail

      • InnerClass

        InnerClass​(java.io.DataInput file)
            throws java.io.IOException
        Constructs object from file stream.
        Parameters:
        file - Input stream.
        Throws:
        java.io.IOException - if an I/O error occurs.
      • InnerClass

        public InnerClass​(InnerClass c)
        Initialize from another object.
        Parameters:
        c - Source to copy.
      • InnerClass

        public InnerClass​(int innerClassIndex,
                          int outerClassIndex,
                          int innerNameIndex,
                          int innerAccessFlags)
        Constructs an InnerClass.
        Parameters:
        innerClassIndex - Class index in constant pool of inner class.
        outerClassIndex - Class index in constant pool of outer class.
        innerNameIndex - Name index in constant pool of inner class.
        innerAccessFlags - Access flags of inner class.
    • Method Detail

      • accept

        public void accept​(Visitor v)
        Called by objects that are traversing the nodes of the tree implicitly defined by the contents of a Java class. I.e., the hierarchy of methods, fields, attributes, etc. spawns a tree of objects.
        Specified by:
        accept in interface Node
        Parameters:
        v - Visitor object.
      • copy

        public InnerClass copy()
        Creates a deep copy of this object.
        Returns:
        deep copy of this object.
      • dump

        public void dump​(java.io.DataOutputStream file)
                  throws java.io.IOException
        Dumps inner class attribute to file stream in binary format.
        Parameters:
        file - Output file stream.
        Throws:
        java.io.IOException - if an I/O error occurs.
      • getInnerAccessFlags

        public int getInnerAccessFlags()
        Gets the access flags of inner class.
        Returns:
        access flags of inner class.
      • getInnerClassIndex

        public int getInnerClassIndex()
        Gets the class index of inner class.
        Returns:
        class index of inner class.
      • getInnerNameIndex

        public int getInnerNameIndex()
        Gets the name index of inner class.
        Returns:
        name index of inner class.
      • getOuterClassIndex

        public int getOuterClassIndex()
        Gets the class index of outer class.
        Returns:
        class index of outer class.
      • setInnerAccessFlags

        public void setInnerAccessFlags​(int innerAccessFlags)
        Sets the access flags for this inner class.
        Parameters:
        innerAccessFlags - access flags for this inner class.
      • setInnerClassIndex

        public void setInnerClassIndex​(int innerClassIndex)
        Sets the index into the constant pool for this class.
        Parameters:
        innerClassIndex - index into the constant pool for this class.
      • setInnerNameIndex

        public void setInnerNameIndex​(int innerNameIndex)
        Sets the index into the constant pool for this class's name.
        Parameters:
        innerNameIndex - index into the constant pool for this class's name.
      • setOuterClassIndex

        public void setOuterClassIndex​(int outerClassIndex)
        Sets the index into the constant pool for the owning class.
        Parameters:
        outerClassIndex - index into the constant pool for the owning class.
      • toString

        public java.lang.String toString()
        Gets the string representation.
        Overrides:
        toString in class java.lang.Object
        Returns:
        String representation.
      • toString

        public java.lang.String toString​(ConstantPool constantPool)
        Gets the resolved string representation.
        Parameters:
        constantPool - the constant pool.
        Returns:
        Resolved string representation.