Interface CBPs.DirectProcessor

Enclosing class:
CBPs

public static interface CBPs.DirectProcessor
  • Method Details

    • skipIfNoField

      CBPs.DirectProcessor 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.

      The following code will execute successfully even if the current class does not have a field named fooCache, the getFoo method will simply not be instrumented.

      
       CBPs.process(cp, ctClass)
           .skipIfNoField("fooCache")
           .insertBefore("getFoo", "fooCache.clear();");
       
    • skipIfNoMethod

      CBPs.DirectProcessor skipIfNoMethod(String methodName)
    • skipIfNoClass

      CBPs.DirectProcessor skipIfNoClass(String className)
    • importPackage

      CBPs.DirectProcessor importPackage(String pkg)
    • importClass

      CBPs.DirectProcessor importClass(Class<?> klass)
    • 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.CannotCompileException
      org.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.NotFoundException
      org.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.NotFoundException
      org.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.NotFoundException
      org.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.NotFoundException
      org.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.NotFoundException
      org.zeroturnaround.bundled.javassist.CannotCompileException