Annotation Interface MethodSpec
public @interface MethodSpec
Specification of the intercepted method.
-
Required Element Summary
Required ElementsModifier and TypeRequired ElementDescriptionThe fully qualified name of the highest type in the class hierarchy where the method is implemented.The name of the method.String[]
The array of all parameter types that the method declares.The return type that the method declares. -
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionboolean
Iffalse
, only the method contained inclassName()
will be instrumented, but not in derived classes.
-
Element Details
-
className
String classNameThe 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 methodNameThe name of the method. If you would like to instrument a constructor, use<init>
.- Returns:
- the method name
-
parameterTypes
String[] parameterTypesThe 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 returnTypeThe 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 subtypesIffalse
, only the method contained inclassName()
will be instrumented, but not in derived classes. Iftrue
, the matching methods inclassName()
and all its subtypes will be instrumented.- Returns:
- if methods from subtypes should be instrumented, too
- Default:
false
-