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
An item in a Dalvik file which is referenced by index.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal intgetIndex()Gets the item index.final booleanhasIndex()Gets whether or not this instance has been assigned an index.final StringGets the index of this item as a string, suitable for including in annotations.final voidsetIndex(int index) Sets the item 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:
trueiff 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 aRuntimeExceptionif called a second (or subsequent) time.- Parameters:
index->= 0;the item index
-
indexString
Gets the index of this item as a string, suitable for including in annotations.- Returns:
non-null;the index string
-