public class ObjectCallbackEnhancer extends CallbackClassFileTransformer
| Modifier and Type | Field and Description |
|---|---|
static String |
FIELD_NAME_CALLBACKS
Field name for callbacks map
|
static String |
FIELD_NAME_CALLBACKS_LOCK
Field name for synchronizer
|
| Constructor and Description |
|---|
ObjectCallbackEnhancer() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
enhanceMethod(javassist.CtMethod method)
Responsible for method enhancing, writing service calls to method.
|
protected boolean |
isEnhanceable(javassist.CtMethod method)
Checks if method is enhanceable.
|
protected byte[] |
transformClass(ClassLoader loader,
byte[] clazzBytes)
Does actual transformation
|
protected String |
writeAfterMethod(javassist.CtMethod method,
int paramLength,
String listenerFieldName)
Writes code that will be inserted after method
|
protected String |
writeBeforeMethod(javassist.CtMethod method,
int paramLength,
String listenerFieldName)
Code that is added in the begining of the method
|
protected void |
writeEnhancedObjectImpl(javassist.CtClass clazz)
Implements
on class |
transformpublic static final String FIELD_NAME_CALLBACKS
public static final String FIELD_NAME_CALLBACKS_LOCK
protected byte[] transformClass(ClassLoader loader, byte[] clazzBytes) throws Exception
transformClass in class CallbackClassFileTransformerloader - class loaderclazzBytes - class bytecodeException - is something went wrongprotected void enhanceMethod(javassist.CtMethod method)
throws javassist.CannotCompileException,
javassist.NotFoundException,
ClassNotFoundException
method - Method that has to be editedjavassist.CannotCompileException - if something went wrongjavassist.NotFoundException - if something went wrongClassNotFoundException - if something went wrongprotected String writeBeforeMethod(javassist.CtMethod method, int paramLength, String listenerFieldName) throws javassist.NotFoundException, javassist.CannotCompileException
method - method that should be editedparamLength - Lenght of methods parameterslistenerFieldName - Listener class that is used for methodjavassist.NotFoundException - if something went wrongjavassist.CannotCompileExceptionprotected String writeAfterMethod(javassist.CtMethod method, int paramLength, String listenerFieldName) throws javassist.NotFoundException
method - method to editparamLength - lenght of method paramenterslistenerFieldName - method listenerjavassist.NotFoundException - if something went wrongprotected void writeEnhancedObjectImpl(javassist.CtClass clazz)
throws javassist.NotFoundException,
javassist.CannotCompileException
on classclazz - class to editjavassist.NotFoundException - if something went wrongjavassist.CannotCompileException - if something went wrongprotected boolean isEnhanceable(javassist.CtMethod method)
ObjectCallback annotation, be not
native and not abstractmethod - method to checkCopyright © 2014–2015. All rights reserved.