Class MethodExitHook.Builder
- java.lang.Object
-
- com.tonic.analysis.instrumentation.hook.MethodExitHook.Builder
-
- Enclosing class:
- MethodExitHook
public static class MethodExitHook.Builder extends Object
Builder forMethodExitHook, defaulting to enabled, priority 100, no values passed and normal returns only.
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MethodExitHookbuild()MethodExitHook.BuildercanModifyReturn(boolean canModifyReturn)Sets whether the hook's return value replaces the value returned.MethodExitHook.Builderenabled(boolean enabled)Sets whether the hook is applied at all.MethodExitHook.Builderfilters(List<InstrumentationFilter> filters)Replaces the filters deciding which methods are instrumented.MethodExitHook.BuilderhookDescriptor(HookDescriptor hookDescriptor)Sets the method the instrumentation will call.MethodExitHook.BuilderinstrumentExceptionalExits(boolean instrumentExceptionalExits)Sets whether exits by thrown exception are hooked as well as returns.MethodExitHook.BuilderpassClassName(boolean passClassName)Sets whether the enclosing class name is passed to the hook.MethodExitHook.BuilderpassMethodName(boolean passMethodName)Sets whether the enclosing method name is passed to the hook.MethodExitHook.BuilderpassReturnValue(boolean passReturnValue)Sets whether the returned value is passed to the hook.MethodExitHook.BuilderpassThis(boolean passThis)Sets whether thethisreference is passed to the hook.MethodExitHook.Builderpriority(int priority)Sets the ordering weight against other hooks on the same site.
-
-
-
Method Detail
-
hookDescriptor
public MethodExitHook.Builder hookDescriptor(HookDescriptor hookDescriptor)
Sets the method the instrumentation will call.- Parameters:
hookDescriptor- the hook method descriptor- Returns:
- this builder
-
filters
public MethodExitHook.Builder filters(List<InstrumentationFilter> filters)
Replaces the filters deciding which methods are instrumented.- Parameters:
filters- the filter list- Returns:
- this builder
-
enabled
public MethodExitHook.Builder enabled(boolean enabled)
Sets whether the hook is applied at all.- Parameters:
enabled- whether the hook is active- Returns:
- this builder
-
priority
public MethodExitHook.Builder priority(int priority)
Sets the ordering weight against other hooks on the same site.- Parameters:
priority- the priority value- Returns:
- this builder
-
passThis
public MethodExitHook.Builder passThis(boolean passThis)
Sets whether thethisreference is passed to the hook.- Parameters:
passThis- whether to pass the receiver- Returns:
- this builder
-
passMethodName
public MethodExitHook.Builder passMethodName(boolean passMethodName)
Sets whether the enclosing method name is passed to the hook.- Parameters:
passMethodName- whether to pass the method name- Returns:
- this builder
-
passClassName
public MethodExitHook.Builder passClassName(boolean passClassName)
Sets whether the enclosing class name is passed to the hook.- Parameters:
passClassName- whether to pass the class name- Returns:
- this builder
-
passReturnValue
public MethodExitHook.Builder passReturnValue(boolean passReturnValue)
Sets whether the returned value is passed to the hook.- Parameters:
passReturnValue- whether to pass the return value- Returns:
- this builder
-
canModifyReturn
public MethodExitHook.Builder canModifyReturn(boolean canModifyReturn)
Sets whether the hook's return value replaces the value returned.- Parameters:
canModifyReturn- whether the hook may substitute a return value- Returns:
- this builder
-
instrumentExceptionalExits
public MethodExitHook.Builder instrumentExceptionalExits(boolean instrumentExceptionalExits)
Sets whether exits by thrown exception are hooked as well as returns.- Parameters:
instrumentExceptionalExits- whether to instrument exceptional exits- Returns:
- this builder
-
build
public MethodExitHook build()
- Returns:
- the configured hook
-
-