Class InnerClassesAttribute


  • public class InnerClassesAttribute
    extends AttributeInfo
    InnerClasses_attribute.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String tag
      The name of this attribute "InnerClasses".
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int accessFlags​(int nth)
      Returns classes[nth].inner_class_access_flags.
      void append​(int inner, int outer, int name, int flags)
      Appends a new entry.
      void append​(java.lang.String inner, java.lang.String outer, java.lang.String name, int flags)
      Appends a new entry.
      AttributeInfo copy​(ConstPool newCp, java.util.Map<java.lang.String,​java.lang.String> classnames)
      Makes a copy.
      int find​(java.lang.String name)
      Finds the entry for the given inner class.
      java.lang.String innerClass​(int nth)
      Returns the class name indicated by classes[nth].inner_class_info_index.
      int innerClassIndex​(int nth)
      Returns classes[nth].inner_class_info_index.
      java.lang.String innerName​(int nth)
      Returns the simple class name indicated by classes[nth].inner_name_index.
      int innerNameIndex​(int nth)
      Returns classes[nth].inner_name_index.
      java.lang.String outerClass​(int nth)
      Returns the class name indicated by classes[nth].outer_class_info_index.
      int outerClassIndex​(int nth)
      Returns classes[nth].outer_class_info_index.
      int remove​(int nth)
      Removes the nth entry.
      void setAccessFlags​(int nth, int flags)
      Sets classes[nth].inner_class_access_flags to the given index.
      void setInnerClassIndex​(int nth, int index)
      Sets classes[nth].inner_class_info_index to the given index.
      void setInnerNameIndex​(int nth, int index)
      Sets classes[nth].inner_name_index to the given index.
      void setOuterClassIndex​(int nth, int index)
      Sets classes[nth].outer_class_info_index to the given index.
      int tableLength()
      Returns number_of_classes.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • tag

        public static final java.lang.String tag
        The name of this attribute "InnerClasses".
        See Also:
        Constant Field Values
    • Method Detail

      • tableLength

        public int tableLength()
        Returns number_of_classes.
      • innerClassIndex

        public int innerClassIndex​(int nth)
        Returns classes[nth].inner_class_info_index.
      • innerClass

        public java.lang.String innerClass​(int nth)
        Returns the class name indicated by classes[nth].inner_class_info_index. The class name is fully-qualified and separated by dot.
        Returns:
        null or the class name.
        See Also:
        ConstPool.getClassInfo(int)
      • setInnerClassIndex

        public void setInnerClassIndex​(int nth,
                                       int index)
        Sets classes[nth].inner_class_info_index to the given index.
      • outerClassIndex

        public int outerClassIndex​(int nth)
        Returns classes[nth].outer_class_info_index.
      • outerClass

        public java.lang.String outerClass​(int nth)
        Returns the class name indicated by classes[nth].outer_class_info_index.
        Returns:
        null or the class name.
      • setOuterClassIndex

        public void setOuterClassIndex​(int nth,
                                       int index)
        Sets classes[nth].outer_class_info_index to the given index.
      • innerNameIndex

        public int innerNameIndex​(int nth)
        Returns classes[nth].inner_name_index.
      • innerName

        public java.lang.String innerName​(int nth)
        Returns the simple class name indicated by classes[nth].inner_name_index.
        Returns:
        null or the class name.
      • setInnerNameIndex

        public void setInnerNameIndex​(int nth,
                                      int index)
        Sets classes[nth].inner_name_index to the given index.
      • accessFlags

        public int accessFlags​(int nth)
        Returns classes[nth].inner_class_access_flags.
      • setAccessFlags

        public void setAccessFlags​(int nth,
                                   int flags)
        Sets classes[nth].inner_class_access_flags to the given index.
      • find

        public int find​(java.lang.String name)
        Finds the entry for the given inner class.
        Parameters:
        name - the fully-qualified class name separated by dot and $.
        Returns:
        the index or -1 if not found.
        Since:
        3.22
      • append

        public void append​(java.lang.String inner,
                           java.lang.String outer,
                           java.lang.String name,
                           int flags)
        Appends a new entry.
        Parameters:
        inner - inner_class_info_index
        outer - outer_class_info_index
        name - inner_name_index
        flags - inner_class_access_flags
      • append

        public void append​(int inner,
                           int outer,
                           int name,
                           int flags)
        Appends a new entry.
        Parameters:
        inner - inner_class_info_index
        outer - outer_class_info_index
        name - inner_name_index
        flags - inner_class_access_flags
      • remove

        public int remove​(int nth)
        Removes the nth entry. It does not eliminate constant pool items that the removed entry refers to. ClassFile.compact() should be executed to remove these unnecessary items.
        Parameters:
        nth - 0, 1, 2, ...
        Returns:
        the number of items after the removal.
        See Also:
        ClassFile.compact()
      • copy

        public AttributeInfo copy​(ConstPool newCp,
                                  java.util.Map<java.lang.String,​java.lang.String> classnames)
        Makes a copy. Class names are replaced according to the given Map object.
        Overrides:
        copy in class AttributeInfo
        Parameters:
        newCp - the constant pool table used by the new copy.
        classnames - pairs of replaced and substituted class names.