Class IndexedItem

java.lang.Object
com.android.dx.dex.file.Item
com.android.dx.dex.file.IndexedItem
Direct Known Subclasses:
CallSiteIdItem, ClassDefItem, HeaderItem, IdItem, MethodHandleItem, ProtoIdItem, StringIdItem

public abstract class IndexedItem extends Item
An item in a Dalvik file which is referenced by index.
  • Constructor Details

    • IndexedItem

      public IndexedItem()
      Constructs an instance. The index is initially unassigned.
  • Method Details

    • hasIndex

      public final boolean hasIndex()
      Gets whether or not this instance has been assigned an index.
      Returns:
      true iff this instance has been assigned an index
    • getIndex

      public final int getIndex()
      Gets the item index.
      Returns:
      >= 0; the index
      Throws:
      RuntimeException - thrown if the item index is not yet assigned
    • setIndex

      public final void setIndex(int index)
      Sets the item index. This method may only ever be called once per instance, and this will throw a RuntimeException if called a second (or subsequent) time.
      Parameters:
      index - >= 0; the item index
    • indexString

      public final String indexString()
      Gets the index of this item as a string, suitable for including in annotations.
      Returns:
      non-null; the index string