Annotation Interface MethodSpec


public @interface MethodSpec
Specification of the intercepted method.
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    The fully qualified name of the highest type in the class hierarchy where the method is implemented.
    The name of the method.
    The array of all parameter types that the method declares.
    The return type that the method declares.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    boolean
    If false, only the method contained in className() will be instrumented, but not in derived classes.
  • Element Details

    • className

      String className
      The fully qualified name of the highest type in the class hierarchy where the method is implemented. Can be an empty string if you would like to instrument all methods with the given name and signature. Packages are separated with dots, inner classes with '$'.
      Returns:
      the class name
    • methodName

      String methodName
      The name of the method. If you would like to instrument a constructor, use <init>.
      Returns:
      the method name
    • parameterTypes

      String[] parameterTypes
      The array of all parameter types that the method declares. The types must be fully qualified. Packages are separated with dots, inner classes with '$'. Arrays are specified with a trailing '[]'. Generic types must be erased (java.util.List<T> -> java.util.List). Type parameters must be replaced by their upper bounds (java.lang.Object for <T>, (java.util.List for <T extends List<U>>.
      Returns:
      the array of the declared types of all parameters
    • returnType

      String returnType
      The return type that the method declares. The type must be fully qualified. Packages are separated with dots, inner classes with '$'. Arrays are specified with a trailing '[]'. Generic types must be erased (java.util.List<T> -> java.util.List). Type parameters must be replaced by their upper bounds (java.lang.Object for <T>, (java.util.List for <T extends List<U>>.
      Returns:
      the return type
    • subtypes

      boolean subtypes
      If false, only the method contained in className() will be instrumented, but not in derived classes. If true, the matching methods in className() and all its subtypes will be instrumented.
      Returns:
      if methods from subtypes should be instrumented, too
      Default:
      false