public class ClassModel
extends java.lang.Object
java.lang.Class
.
If the java class mode changes we may need to modify this to accommodate.Modifier and Type | Class and Description |
---|---|
static class |
ClassModel.Access |
class |
ClassModel.AttributePool |
class |
ClassModel.ClassModelField |
class |
ClassModel.ClassModelInterface |
class |
ClassModel.ClassModelMethod |
class |
ClassModel.ConstantPool |
static class |
ClassModel.ConstantPoolType |
static class |
ClassModel.MethodDescription |
Modifier and Type | Field and Description |
---|---|
static char |
SIGC_ARRAY |
static char |
SIGC_BOOLEAN |
static char |
SIGC_BYTE |
static char |
SIGC_CHAR |
static char |
SIGC_CLASS |
static char |
SIGC_DOUBLE |
static char |
SIGC_END_CLASS |
static char |
SIGC_END_METHOD |
static char |
SIGC_FLOAT |
static char |
SIGC_INT |
static char |
SIGC_LONG |
static char |
SIGC_PACKAGE |
static char |
SIGC_SHORT |
static char |
SIGC_START_METHOD |
static char |
SIGC_VOID |
Constructor and Description |
---|
ClassModel(java.lang.Class<?> _class)
Create a ClassModel representing a given Class.
|
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
convert(java.lang.String _string) |
static java.lang.String |
convert(java.lang.String _string,
java.lang.String _insert) |
static java.lang.String |
convert(java.lang.String _string,
java.lang.String _insert,
boolean _showFullClassName) |
int |
getAccessFlags() |
ClassModel.AttributePool |
getAttributePool() |
java.lang.Class<?> |
getClassWeAreModelling() |
ClassModel.ConstantPool |
getConstantPool() |
Entrypoint |
getEntrypoint() |
Entrypoint |
getEntrypoint(java.lang.String _entrypointName,
java.lang.Object _k) |
ClassModel.ClassModelField |
getField(java.lang.String _name) |
ClassModel.ClassModelField |
getField(java.lang.String _name,
java.lang.String _descriptor) |
java.util.List<ClassModel.ClassModelField> |
getFieldPoolEntries() |
int |
getMagic() |
int |
getMajorVersion() |
ClassModel.ClassModelMethod |
getMethod(ClassModel.ConstantPool.MethodEntry _methodEntry,
boolean _isSpecial)
Look up a ConstantPool MethodEntry and return the corresponding Method.
|
ClassModel.ClassModelMethod |
getMethod(java.lang.String _name,
java.lang.String _descriptor) |
static ClassModel.MethodDescription |
getMethodDescription(java.lang.String _string) |
MethodModel |
getMethodModel(java.lang.String _name,
java.lang.String _signature)
Create a MethodModel for a given method name and signature.
|
int |
getMinorVersion() |
java.util.ArrayList<java.lang.Long> |
getStructMemberOffsets() |
java.util.ArrayList<ClassModel.ConstantPool.FieldEntry> |
getStructMembers() |
java.util.ArrayList<InstructionSet.TypeSpec> |
getStructMemberTypes() |
int |
getSuperClassConstantPoolIndex() |
ClassModel |
getSuperClazz()
Getter for superClazz
|
int |
getThisClassConstantPoolIndex() |
int |
getTotalStructSize() |
boolean |
isSuperClass(java.lang.Class<?> other)
Determine if this is the superclass of some other class.
|
boolean |
isSuperClass(java.lang.String otherClassName)
Determine if this is the superclass of some other named class.
|
void |
parse(java.lang.Class<?> _class)
We extract the class's classloader and name and delegate to private parse method.
|
void |
replaceSuperClazz(ClassModel c) |
void |
setTotalStructSize(int x) |
static java.lang.String |
typeName(char _typeChar)
Convert a given JNI character type (say 'I') to its type name ('int').
|
public static final char SIGC_VOID
public static final char SIGC_BOOLEAN
public static final char SIGC_BYTE
public static final char SIGC_CHAR
public static final char SIGC_SHORT
public static final char SIGC_INT
public static final char SIGC_LONG
public static final char SIGC_FLOAT
public static final char SIGC_DOUBLE
public static final char SIGC_ARRAY
public static final char SIGC_CLASS
public static final char SIGC_START_METHOD
public static final char SIGC_END_CLASS
public static final char SIGC_END_METHOD
public static final char SIGC_PACKAGE
public ClassModel(java.lang.Class<?> _class) throws ClassParseException
getClassLoader().getResourceAsStream(name))
.
For dynamic languages creating classes on the fly we may need another approach._class
- The class we will extract the model fromClassParseException
public boolean isSuperClass(java.lang.String otherClassName)
otherClassName
- The name of the class to compare againstpublic boolean isSuperClass(java.lang.Class<?> other)
otherClass
- The class to compare againstpublic ClassModel getSuperClazz()
public void replaceSuperClazz(ClassModel c)
public static java.lang.String typeName(char _typeChar)
_typeChar
- public static java.lang.String convert(java.lang.String _string)
public static java.lang.String convert(java.lang.String _string, java.lang.String _insert)
public static java.lang.String convert(java.lang.String _string, java.lang.String _insert, boolean _showFullClassName)
public static ClassModel.MethodDescription getMethodDescription(java.lang.String _string)
public void parse(java.lang.Class<?> _class) throws ClassParseException
_class
- The class we wish to modelClassParseException
public int getMagic()
public int getMajorVersion()
public int getMinorVersion()
public int getAccessFlags()
public ClassModel.ConstantPool getConstantPool()
public int getThisClassConstantPoolIndex()
public int getSuperClassConstantPoolIndex()
public ClassModel.AttributePool getAttributePool()
public ClassModel.ClassModelField getField(java.lang.String _name, java.lang.String _descriptor)
public ClassModel.ClassModelField getField(java.lang.String _name)
public ClassModel.ClassModelMethod getMethod(java.lang.String _name, java.lang.String _descriptor)
public java.util.List<ClassModel.ClassModelField> getFieldPoolEntries()
public ClassModel.ClassModelMethod getMethod(ClassModel.ConstantPool.MethodEntry _methodEntry, boolean _isSpecial)
_methodEntry
- The ConstantPool MethodEntry we want._isSpecial
- True if we wish to delegate to super (to support super.foo()
)public MethodModel getMethodModel(java.lang.String _name, java.lang.String _signature) throws AparapiException
_name
- _signature
- AparapiException
public java.util.ArrayList<ClassModel.ConstantPool.FieldEntry> getStructMembers()
public java.util.ArrayList<java.lang.Long> getStructMemberOffsets()
public java.util.ArrayList<InstructionSet.TypeSpec> getStructMemberTypes()
public int getTotalStructSize()
public void setTotalStructSize(int x)
public java.lang.Class<?> getClassWeAreModelling()
public Entrypoint getEntrypoint(java.lang.String _entrypointName, java.lang.Object _k) throws AparapiException
AparapiException
public Entrypoint getEntrypoint() throws AparapiException
AparapiException