Class MethodEntryHook.Builder
- java.lang.Object
-
- com.tonic.analysis.instrumentation.hook.MethodEntryHook.Builder
-
- Enclosing class:
- MethodEntryHook
public static class MethodEntryHook.Builder extends Object
Fluent builder for a method entry hook; every setting has a default except the hook descriptor.
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MethodEntryHookbuild()MethodEntryHook.Builderenabled(boolean enabled)Sets whether the hook is applied at all; defaults to true.MethodEntryHook.Builderfilters(List<InstrumentationFilter> filters)Sets the filters deciding which methods get instrumented.MethodEntryHook.BuilderhookDescriptor(HookDescriptor hookDescriptor)Sets the static method the hook calls.MethodEntryHook.BuilderparameterIndices(List<Integer> parameterIndices)Sets the individual parameter positions to pass, boxed when primitive.MethodEntryHook.BuilderpassAllParameters(boolean passAllParameters)Sets whether all parameters are passed as one Object array.MethodEntryHook.BuilderpassClassName(boolean passClassName)Sets whether the instrumented class's name is passed to the hook.MethodEntryHook.BuilderpassMethodName(boolean passMethodName)Sets whether the instrumented method's name is passed to the hook.MethodEntryHook.BuilderpassThis(boolean passThis)Sets whether the receiver is passed to the hook, null for static methods.MethodEntryHook.Builderpriority(int priority)Sets the ordering priority among hooks; defaults to 100.
-
-
-
Method Detail
-
hookDescriptor
public MethodEntryHook.Builder hookDescriptor(HookDescriptor hookDescriptor)
Sets the static method the hook calls.- Parameters:
hookDescriptor- the target hook method- Returns:
- this builder
-
filters
public MethodEntryHook.Builder filters(List<InstrumentationFilter> filters)
Sets the filters deciding which methods get instrumented.- Parameters:
filters- the filter list, replacing the current one- Returns:
- this builder
-
enabled
public MethodEntryHook.Builder enabled(boolean enabled)
Sets whether the hook is applied at all; defaults to true.- Parameters:
enabled- true to apply the hook- Returns:
- this builder
-
priority
public MethodEntryHook.Builder priority(int priority)
Sets the ordering priority among hooks; defaults to 100.- Parameters:
priority- the priority value- Returns:
- this builder
-
passThis
public MethodEntryHook.Builder passThis(boolean passThis)
Sets whether the receiver is passed to the hook, null for static methods.- Parameters:
passThis- true to pass the receiver- Returns:
- this builder
-
passMethodName
public MethodEntryHook.Builder passMethodName(boolean passMethodName)
Sets whether the instrumented method's name is passed to the hook.- Parameters:
passMethodName- true to pass the method name- Returns:
- this builder
-
passClassName
public MethodEntryHook.Builder passClassName(boolean passClassName)
Sets whether the instrumented class's name is passed to the hook.- Parameters:
passClassName- true to pass the class name- Returns:
- this builder
-
passAllParameters
public MethodEntryHook.Builder passAllParameters(boolean passAllParameters)
Sets whether all parameters are passed as one Object array.- Parameters:
passAllParameters- true to pass every parameter- Returns:
- this builder
-
parameterIndices
public MethodEntryHook.Builder parameterIndices(List<Integer> parameterIndices)
Sets the individual parameter positions to pass, boxed when primitive.- Parameters:
parameterIndices- the parameter indices, replacing the current list- Returns:
- this builder
-
build
public MethodEntryHook build()
- Returns:
- a hook with the configured settings
-
-