Interface CBPs.DirectProcessor
- Enclosing class:
- CBPs
public static interface CBPs.DirectProcessor
-
Method Summary
Modifier and TypeMethodDescriptionaddInterface(Class<?> intf) addInterface(String intfName) addLocalVariableTo(String methodName, Class<?> variableClass, String variableName, String initExpr) addLoggerField(String fieldName, String loggerName) importClass(Class<?> klass) importPackage(String pkg) insertAfter(String methodName, String src) insertAfterClinit(String src) insertBefore(String methodName, String src) insertBefore(String methodName, org.zeroturnaround.bundled.javassist.CtClass[] paramTypes, String src) instrument(String methodName, org.zeroturnaround.bundled.javassist.expr.ExprEditor exprEditor) Instruments a declared method with the given name.instrumentAll(String methodName, org.zeroturnaround.bundled.javassist.expr.ExprEditor exprEditor) Instruments all declared methods with the given name.removeFinalFromField(String field) skipIfNoClass(String className) skipIfNoField(String fieldName) If the current class does not have a declared field with the given name, then all following processing commands will be turned into no-ops.skipIfNoMethod(String methodName)
-
Method Details
-
skipIfNoField
If the current class does not have a declared field with the given name, then all following processing commands will be turned into no-ops.The following code will execute successfully even if the current class does not have a field named
fooCache, thegetFoomethod will simply not be instrumented.CBPs.process(cp, ctClass) .skipIfNoField("fooCache") .insertBefore("getFoo", "fooCache.clear();"); -
skipIfNoMethod
-
skipIfNoClass
-
importPackage
-
importClass
-
addInterface
CBPs.DirectProcessor addInterface(String intfName) throws org.zeroturnaround.bundled.javassist.NotFoundException - Throws:
org.zeroturnaround.bundled.javassist.NotFoundException
-
addInterface
CBPs.DirectProcessor addInterface(Class<?> intf) throws org.zeroturnaround.bundled.javassist.NotFoundException - Throws:
org.zeroturnaround.bundled.javassist.NotFoundException
-
addField
CBPs.DirectProcessor addField(String field) throws org.zeroturnaround.bundled.javassist.CannotCompileException - Throws:
org.zeroturnaround.bundled.javassist.CannotCompileException
-
removeFinalFromField
CBPs.DirectProcessor removeFinalFromField(String field) throws org.zeroturnaround.bundled.javassist.CannotCompileException - Throws:
org.zeroturnaround.bundled.javassist.CannotCompileException
-
addLoggerField
CBPs.DirectProcessor addLoggerField(String fieldName, String loggerName) throws org.zeroturnaround.bundled.javassist.CannotCompileException - Throws:
org.zeroturnaround.bundled.javassist.CannotCompileException
-
addMethod
CBPs.DirectProcessor addMethod(String method) throws org.zeroturnaround.bundled.javassist.CannotCompileException - Throws:
org.zeroturnaround.bundled.javassist.CannotCompileException
-
addLocalVariableTo
CBPs.DirectProcessor addLocalVariableTo(String methodName, Class<?> variableClass, String variableName, String initExpr) throws org.zeroturnaround.bundled.javassist.CannotCompileException, org.zeroturnaround.bundled.javassist.NotFoundException - Throws:
org.zeroturnaround.bundled.javassist.CannotCompileExceptionorg.zeroturnaround.bundled.javassist.NotFoundException
-
insertAfterClinit
CBPs.DirectProcessor insertAfterClinit(String src) throws org.zeroturnaround.bundled.javassist.CannotCompileException - Throws:
org.zeroturnaround.bundled.javassist.CannotCompileException
-
insertBeforeLeafCtors
CBPs.DirectProcessor insertBeforeLeafCtors(String src) throws org.zeroturnaround.bundled.javassist.CannotCompileException - Throws:
org.zeroturnaround.bundled.javassist.CannotCompileException
-
insertAfterLeafCtors
CBPs.DirectProcessor insertAfterLeafCtors(String src) throws org.zeroturnaround.bundled.javassist.CannotCompileException - Throws:
org.zeroturnaround.bundled.javassist.CannotCompileException
-
insertBefore
CBPs.DirectProcessor insertBefore(String methodName, String src) throws org.zeroturnaround.bundled.javassist.NotFoundException, org.zeroturnaround.bundled.javassist.CannotCompileException - Throws:
org.zeroturnaround.bundled.javassist.NotFoundExceptionorg.zeroturnaround.bundled.javassist.CannotCompileException
-
insertBefore
CBPs.DirectProcessor insertBefore(String methodName, org.zeroturnaround.bundled.javassist.CtClass[] paramTypes, String src) throws org.zeroturnaround.bundled.javassist.NotFoundException, org.zeroturnaround.bundled.javassist.CannotCompileException - Throws:
org.zeroturnaround.bundled.javassist.NotFoundExceptionorg.zeroturnaround.bundled.javassist.CannotCompileException
-
insertAfter
CBPs.DirectProcessor insertAfter(String methodName, String src) throws org.zeroturnaround.bundled.javassist.NotFoundException, org.zeroturnaround.bundled.javassist.CannotCompileException - Throws:
org.zeroturnaround.bundled.javassist.NotFoundExceptionorg.zeroturnaround.bundled.javassist.CannotCompileException
-
instrument
CBPs.DirectProcessor instrument(String methodName, org.zeroturnaround.bundled.javassist.expr.ExprEditor exprEditor) throws org.zeroturnaround.bundled.javassist.NotFoundException, org.zeroturnaround.bundled.javassist.CannotCompileException Instruments a declared method with the given name. If there are multiple methods with the same name, only one of them will be instrumented.- Throws:
org.zeroturnaround.bundled.javassist.NotFoundExceptionorg.zeroturnaround.bundled.javassist.CannotCompileException- See Also:
-
instrumentAll
CBPs.DirectProcessor instrumentAll(String methodName, org.zeroturnaround.bundled.javassist.expr.ExprEditor exprEditor) throws org.zeroturnaround.bundled.javassist.NotFoundException, org.zeroturnaround.bundled.javassist.CannotCompileException Instruments all declared methods with the given name.- Throws:
org.zeroturnaround.bundled.javassist.NotFoundExceptionorg.zeroturnaround.bundled.javassist.CannotCompileException
-