public final class ClassDefItem extends IndexedItem
| Constructor and Description |
|---|
ClassDefItem(CstType thisClass,
int accessFlags,
CstType superclass,
TypeList interfaces,
CstString sourceFile)
Constructs an instance.
|
| Modifier and Type | Method and Description |
|---|---|
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(java.io.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.
|
java.util.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. |
getIndex, hasIndex, indexString, setIndexpublic 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 unknownpublic ItemType itemType()
public int writeSize()
public 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 populatepublic 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.public 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 unknownpublic 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 java.util.ArrayList<EncodedMethod> getMethods()
non-null; list of all methodspublic void setClassAnnotations(Annotations annotations, DexFile dexFile)
annotations - non-null; annotations to set for this classdexFile - non-null; dex outputpublic void addFieldAnnotations(CstFieldRef field, Annotations annotations, DexFile dexFile)
field - non-null; field in questionannotations - non-null; associated annotations to adddexFile - non-null; dex outputpublic void addMethodAnnotations(CstMethodRef method, Annotations annotations, DexFile dexFile)
method - non-null; method in questionannotations - non-null; associated annotations to adddexFile - non-null; dex outputpublic 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 methodnull-ok; the method annotations, if anypublic AnnotationsList getParameterAnnotations(CstMethodRef method)
method - non-null; the methodnull-ok; the parameter annotations, if anypublic void debugPrint(java.io.Writer out,
boolean verbose)
out - non-null; where to output toverbose - whether to be verbose with the outputCopyright © 2020. All Rights Reserved.