Package com.android.dx.dex.file
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
-
Method Summary
Modifier and TypeMethodDescriptionfinal int
getIndex()
Gets the item index.final boolean
hasIndex()
Gets whether or not this instance has been assigned an index.final String
Gets the index of this item as a string, suitable for including in annotations.final void
setIndex
(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:
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 aRuntimeException
if 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
-