|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jpox.enhancer.AbstractClassEnhancer
org.jpox.enhancer.asm.ASMClassEnhancer
public class ASMClassEnhancer
Class enhancer using ASM (http://asm.objectweb.org). Assumes that the version of ASM is 3.0 or above. ASM operates using a SAXParser-like "visitor-pattern". We utilise this as follows :-
| Nested Class Summary | |
|---|---|
static class |
ASMClassEnhancer.MyClassVisitor
Convenience class to look up the class name for a file. |
| Field Summary | |
|---|---|
protected java.lang.String |
asmClassName
ASM Class name for this class (replace . |
protected byte[] |
classBytes
Bytes of the class (after enhancing). |
protected java.lang.String |
classDescriptor
Class descriptor for this class. |
protected java.lang.Class |
cls
Class that is being enhanced. |
protected byte[] |
inputBytes
Bytes of the input class (only when enhancing generated classes with no class file). |
protected java.lang.String |
inputResourceName
Resource name of the input class (only when the class exists in a class file). |
| Fields inherited from class org.jpox.enhancer.AbstractClassEnhancer |
|---|
className, clr, cmd, fieldsToAdd, initialised, LOCALISER, methodsToAdd, update |
| Constructor Summary | |
|---|---|
ASMClassEnhancer(org.jpox.metadata.ClassMetaData cmd,
org.jpox.ClassLoaderResolver clr)
Constructor. |
|
ASMClassEnhancer(org.jpox.metadata.ClassMetaData cmd,
org.jpox.ClassLoaderResolver clr,
byte[] classBytes)
Constructor. |
|
| Method Summary | |
|---|---|
protected boolean |
checkClassIsEnhanced(boolean logErrors)
Convenience method to return if a class is enhanced. |
boolean |
checkEnhanced()
Check whether the class is enhanced. |
boolean |
enhance()
Method to enhance a classes definition. |
java.lang.String |
getASMClassName()
Accessor for the ASM class name |
byte[] |
getBytes()
Accessor for the class bytes. |
java.lang.String |
getClassDescriptor()
Accessor for the class descriptor for the class being enhanced |
java.lang.Class |
getClassEnhanced()
Accessor for the class being enhanced. |
static java.lang.String |
getClassNameForFileName(java.lang.String filename)
Convenience accessor for the class name that is stored in a particular class. |
protected void |
initialiseFieldsList()
Method to initialise the list of fields to add. |
protected void |
initialiseMethodsList()
Method to initialise the list of methods to add. |
void |
save(java.lang.String directoryName)
Method to save the class definition bytecode into a class file. |
void |
verify()
Verify mode for class files. |
| Methods inherited from class org.jpox.enhancer.AbstractClassEnhancer |
|---|
getClassLoaderResolver, getClassMetaData, getFieldsList, getMethodsList, initialise, isPersistenceCapable, requiresDetachable |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.lang.String inputResourceName
protected byte[] inputBytes
protected final java.lang.Class cls
protected byte[] classBytes
protected java.lang.String asmClassName
protected java.lang.String classDescriptor
| Constructor Detail |
|---|
public ASMClassEnhancer(org.jpox.metadata.ClassMetaData cmd,
org.jpox.ClassLoaderResolver clr)
cmd - MetaData for the class to be enhancedclr - ClassLoader resolver
public ASMClassEnhancer(org.jpox.metadata.ClassMetaData cmd,
org.jpox.ClassLoaderResolver clr,
byte[] classBytes)
cmd - MetaData for the class to be enhancedclr - ClassLoader resolver| Method Detail |
|---|
public static java.lang.String getClassNameForFileName(java.lang.String filename)
filename - Name of the file
public java.lang.Class getClassEnhanced()
public java.lang.String getASMClassName()
public java.lang.String getClassDescriptor()
protected void initialiseMethodsList()
initialiseMethodsList in class AbstractClassEnhancerprotected void initialiseFieldsList()
initialiseFieldsList in class AbstractClassEnhancerpublic boolean enhance()
public byte[] getBytes()
public void save(java.lang.String directoryName)
throws java.io.IOException
save in interface ClassEnhancersave in class AbstractClassEnhancerdirectoryName - Name of a directory (or null to overwrite the class)
java.io.IOException - If an I/O error occurs in the write.public boolean checkEnhanced()
ClassEnhancer
public void verify()
throws java.lang.Exception
verify in interface ClassEnhancerverify in class AbstractClassEnhancerjava.lang.Exception - Thrown if an error occurs.protected boolean checkClassIsEnhanced(boolean logErrors)
logErrors - Whether to log any errors (missing methods etc) as errors (otherwise info/debug)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||