|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.android.dx.dex.file.Item
com.android.dx.dex.file.IndexedItem
com.android.dx.dex.file.ClassDefItem
public final class ClassDefItem
Representation of a Dalvik class, which is basically a set of members (fields or methods) along with a few more pieces of information.
| Constructor Summary | |
|---|---|
ClassDefItem(CstType thisClass,
int accessFlags,
CstType superclass,
TypeList interfaces,
CstString sourceFile)
Constructs an instance. |
|
| Method Summary | |
|---|---|
void |
addContents(DexFile file)
Populates a DexFile with items from within this instance. |
void |
addDirectMethod(EncodedMethod method)
Adds a direct ( static and/or private) method. |
void |
addFieldAnnotations(CstFieldRef field,
Annotations annotations,
DexFile dexFile)
Adds a field annotations item to this class. |
void |
addInstanceField(EncodedField field)
Adds an instance field. |
void |
addMethodAnnotations(CstMethodRef method,
Annotations annotations,
DexFile dexFile)
Adds a method annotations item to this class. |
void |
addParameterAnnotations(CstMethodRef method,
AnnotationsList list,
DexFile dexFile)
Adds a parameter annotations item to this class. |
void |
addStaticField(EncodedField field,
Constant value)
Adds a static field. |
void |
addVirtualMethod(EncodedMethod method)
Adds a virtual method. |
void |
debugPrint(Writer out,
boolean verbose)
Prints out the contents of this instance, in a debugging-friendly way. |
int |
getAccessFlags()
Gets the access flags. |
TypeList |
getInterfaces()
Gets the list of interfaces implemented. |
Annotations |
getMethodAnnotations(CstMethodRef method)
Gets the method annotations for a given method, if any. |
ArrayList<EncodedMethod> |
getMethods()
Gets all the methods in this class. |
AnnotationsList |
getParameterAnnotations(CstMethodRef method)
Gets the parameter annotations for a given method, if any. |
CstString |
getSourceFile()
Gets the source file name. |
CstType |
getSuperclass()
Gets the superclass. |
CstType |
getThisClass()
Gets the constant corresponding to this class. |
ItemType |
itemType()
Returns the item type for this instance. |
void |
setClassAnnotations(Annotations annotations,
DexFile dexFile)
Sets the direct annotations on this class. |
int |
writeSize()
Gets the size of this instance when written, in bytes. |
void |
writeTo(DexFile file,
AnnotatedOutput out)
Writes the representation of this instance to the given data section, using the given DexFile to look things up as needed. |
| Methods inherited from class com.android.dx.dex.file.IndexedItem |
|---|
getIndex, hasIndex, indexString, setIndex |
| Methods inherited from class com.android.dx.dex.file.Item |
|---|
typeName |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ClassDefItem(CstType thisClass,
int accessFlags,
CstType superclass,
TypeList interfaces,
CstString sourceFile)
thisClass - non-null; type constant for this classaccessFlags - access flagssuperclass - null-ok; superclass or null if
this class is a/the root classinterfaces - non-null; list of implemented interfacessourceFile - null-ok; source file name or
null if unknown| Method Detail |
|---|
public ItemType itemType()
itemType in class Itemnon-null; the item typepublic int writeSize()
writeSize in class Item>= 0; the write sizepublic void addContents(DexFile file)
DexFile with items from within this instance.
This will not add an item to the file for this instance itself
(which should have been done by whatever refers to this instance).
Note: Subclasses must override this to do something appropriate.
addContents in class Itemfile - non-null; the file to populate
public void writeTo(DexFile file,
AnnotatedOutput out)
DexFile to look things up as needed.
If this instance keeps track of its offset, then this method will
note the written offset and will also throw an exception if this
instance has already been written.
writeTo in class Itemfile - non-null; the file to use for referenceout - non-null; where to write topublic CstType getThisClass()
non-null; the constantpublic int getAccessFlags()
public CstType getSuperclass()
null-ok; the superclass or null if
this class is a/the root classpublic TypeList getInterfaces()
non-null; the interfaces listpublic CstString getSourceFile()
null-ok; the source file name or null if unknown
public void addStaticField(EncodedField field,
Constant value)
field - non-null; the field to addvalue - null-ok; initial value for the field, if anypublic void addInstanceField(EncodedField field)
field - non-null; the field to addpublic void addDirectMethod(EncodedMethod method)
static and/or private) method.
method - non-null; the method to addpublic void addVirtualMethod(EncodedMethod method)
method - non-null; the method to addpublic ArrayList<EncodedMethod> getMethods()
non-null; list of all methods
public void setClassAnnotations(Annotations annotations,
DexFile dexFile)
annotations - non-null; annotations to set for this classdexFile - non-null; dex output
public void addFieldAnnotations(CstFieldRef field,
Annotations annotations,
DexFile dexFile)
field - non-null; field in questionannotations - non-null; associated annotations to adddexFile - non-null; dex output
public void addMethodAnnotations(CstMethodRef method,
Annotations annotations,
DexFile dexFile)
method - non-null; method in questionannotations - non-null; associated annotations to adddexFile - non-null; dex output
public void addParameterAnnotations(CstMethodRef method,
AnnotationsList list,
DexFile dexFile)
method - non-null; method in questionlist - non-null; associated list of annotation sets to adddexFile - non-null; dex outputpublic Annotations getMethodAnnotations(CstMethodRef method)
method - non-null; the method
null-ok; the method annotations, if anypublic AnnotationsList getParameterAnnotations(CstMethodRef method)
method - non-null; the method
null-ok; the parameter annotations, if any
public void debugPrint(Writer out,
boolean verbose)
out - non-null; where to output toverbose - whether to be verbose with the output
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||