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 interface |
ClassModel.LocalVariableInfo |
static interface |
ClassModel.LocalVariableTableEntry<T extends ClassModel.LocalVariableInfo> |
static class |
ClassModel.MethodDescription |
private static class |
ClassModel.SignatureParseState |
Modifier | Constructor and Description |
---|---|
private |
ClassModel(java.lang.Class<?> _class)
Create a ClassModel representing a given Class.
|
(package private) |
ClassModel(java.lang.Class<?> _clazz,
byte[] _bytes) |
Modifier and Type | Method and Description |
---|---|
(package private) Entrypoint |
computeBasicEntrypoint(EntrypointKey entrypointKey) |
private MethodModel |
computeMethodModel(MethodKey methodKey) |
private java.util.Set<java.lang.String> |
computeNoCLMethods() |
private java.util.Map<java.lang.String,Kernel.PrivateMemorySpace> |
computePrivateMemoryFields() |
private java.lang.Integer |
computePrivateMemorySize(java.lang.String fieldName) |
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) |
static ClassModel |
createClassModel(java.lang.Class<?> _class) |
private static ClassModel |
createClassModelInternal(java.lang.Class<?> key) |
int |
getAccessFlags() |
ClassModel.AttributePool |
getAttributePool() |
java.lang.Class<?> |
getClassWeAreModelling() |
ClassModel.ConstantPool |
getConstantPool() |
Entrypoint |
getEntrypoint() |
Entrypoint |
getEntrypoint(java.lang.String _entrypointName,
java.lang.Object _k) |
(package private) Entrypoint |
getEntrypoint(java.lang.String _entrypointName,
java.lang.String _descriptor,
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.
|
private ClassModel.ClassModelMethod |
getMethodOrNull(java.lang.String _name,
java.lang.String _descriptor) |
int |
getMinorVersion() |
java.util.Set<java.lang.String> |
getNoCLMethods() |
java.lang.Integer |
getPrivateMemorySize(java.lang.String fieldName)
If a field does not satisfy the private memory conditions, null, otherwise the size of private memory required.
|
static java.lang.Integer |
getPrivateMemorySizeFromField(java.lang.reflect.Field field) |
static java.lang.Integer |
getPrivateMemorySizeFromFieldName(java.lang.String fieldName) |
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() |
static void |
invalidateCaches() |
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.
|
(package private) void |
parse(java.lang.Class<?> _class) |
void |
replaceSuperClazz(ClassModel c) |
void |
setTotalStructSize(int x) |
java.lang.String |
toString() |
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
private static java.util.logging.Logger logger
private ClassModel superClazz
private Memoizer<java.util.Set<java.lang.String>> noClMethods
private Memoizer<java.util.Map<java.lang.String,Kernel.PrivateMemorySpace>> privateMemoryFields
private ValueCache<java.lang.String,java.lang.Integer,ClassParseException> privateMemorySizes
private static final ValueCache<java.lang.Class<?>,ClassModel,ClassParseException> classModelCache
private int magic
private int minorVersion
private int majorVersion
private ClassModel.ConstantPool constantPool
private int accessFlags
private int thisClassConstantPoolIndex
private int superClassConstantPoolIndex
private final java.util.List<ClassModel.ClassModelInterface> interfaces
private final java.util.List<ClassModel.ClassModelField> fields
private final java.util.List<ClassModel.ClassModelMethod> methods
private ClassModel.AttributePool attributePool
private static java.lang.ClassLoader classModelLoader
private java.lang.Class<?> clazz
private ValueCache<MethodKey,MethodModel,AparapiException> methodModelCache
private final java.util.ArrayList<ClassModel.ConstantPool.FieldEntry> structMembers
private final java.util.ArrayList<java.lang.Long> structMemberOffsets
private final java.util.ArrayList<InstructionSet.TypeSpec> structMemberTypes
private int totalStructSize
private final ValueCache<EntrypointKey,Entrypoint,AparapiException> entrypointCache
private 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
ClassModel(java.lang.Class<?> _clazz, byte[] _bytes) throws ClassParseException
ClassParseException
public boolean isSuperClass(java.lang.String otherClassName)
otherClassName
- The name of the class to compare againstpublic boolean isSuperClass(java.lang.Class<?> other)
other
- The class to compare againstpublic ClassModel getSuperClazz()
public void replaceSuperClazz(ClassModel c)
public static java.lang.String typeName(char _typeChar)
_typeChar
- public java.lang.Integer getPrivateMemorySize(java.lang.String fieldName) throws ClassParseException
ClassParseException
private java.lang.Integer computePrivateMemorySize(java.lang.String fieldName) throws ClassParseException
ClassParseException
private java.util.Map<java.lang.String,Kernel.PrivateMemorySpace> computePrivateMemoryFields()
public static java.lang.Integer getPrivateMemorySizeFromField(java.lang.reflect.Field field)
public static java.lang.Integer getPrivateMemorySizeFromFieldName(java.lang.String fieldName) throws ClassParseException
ClassParseException
public java.util.Set<java.lang.String> getNoCLMethods()
private java.util.Set<java.lang.String> computeNoCLMethods()
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)
private static ClassModel createClassModelInternal(java.lang.Class<?> key) throws ClassParseException
ClassParseException
public static ClassModel createClassModel(java.lang.Class<?> _class) throws ClassParseException
ClassParseException
void parse(java.lang.Class<?> _class) throws ClassParseException, java.lang.ClassNotFoundException
ClassParseException
java.lang.ClassNotFoundException
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)
private ClassModel.ClassModelMethod getMethodOrNull(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
private MethodModel computeMethodModel(MethodKey methodKey) throws AparapiException
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)
Entrypoint getEntrypoint(java.lang.String _entrypointName, java.lang.String _descriptor, java.lang.Object _k) throws AparapiException
AparapiException
Entrypoint computeBasicEntrypoint(EntrypointKey entrypointKey) throws AparapiException
AparapiException
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
public static void invalidateCaches()
public java.lang.String toString()
toString
in class java.lang.Object