Class FieldWriteHook.Builder
- java.lang.Object
-
- com.tonic.analysis.instrumentation.hook.FieldWriteHook.Builder
-
- Enclosing class:
- FieldWriteHook
public static class FieldWriteHook.Builder extends Object
Builder forFieldWriteHook, defaulting to enabled, priority 100, no values passed, and both static and instance writes instrumented.
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FieldWriteHookbuild()FieldWriteHook.BuildercanModifyValue(boolean canModifyValue)Sets whether the hook's return value replaces the value written.FieldWriteHook.Builderenabled(boolean enabled)Sets whether the hook is applied at all.FieldWriteHook.Builderfilters(List<InstrumentationFilter> filters)Replaces the filters deciding which sites are instrumented.FieldWriteHook.BuilderhookDescriptor(HookDescriptor hookDescriptor)Sets the method the instrumentation will call.FieldWriteHook.BuilderinstrumentInstance(boolean instrumentInstance)Sets whether PUTFIELD sites are instrumented.FieldWriteHook.BuilderinstrumentStatic(boolean instrumentStatic)Sets whether PUTSTATIC sites are instrumented.FieldWriteHook.BuilderpassFieldName(boolean passFieldName)Sets whether the field name is passed to the hook.FieldWriteHook.BuilderpassNewValue(boolean passNewValue)Sets whether the value being written is passed to the hook.FieldWriteHook.BuilderpassOldValue(boolean passOldValue)Sets whether the previous field value is read and passed to the hook.FieldWriteHook.BuilderpassOwner(boolean passOwner)Sets whether the owning object is passed to the hook.FieldWriteHook.Builderpriority(int priority)Sets the ordering weight against other hooks on the same site.
-
-
-
Method Detail
-
hookDescriptor
public FieldWriteHook.Builder hookDescriptor(HookDescriptor hookDescriptor)
Sets the method the instrumentation will call.- Parameters:
hookDescriptor- the hook method descriptor- Returns:
- this builder
-
filters
public FieldWriteHook.Builder filters(List<InstrumentationFilter> filters)
Replaces the filters deciding which sites are instrumented.- Parameters:
filters- the filter list- Returns:
- this builder
-
enabled
public FieldWriteHook.Builder enabled(boolean enabled)
Sets whether the hook is applied at all.- Parameters:
enabled- whether the hook is active- Returns:
- this builder
-
priority
public FieldWriteHook.Builder priority(int priority)
Sets the ordering weight against other hooks on the same site.- Parameters:
priority- the priority value- Returns:
- this builder
-
passOwner
public FieldWriteHook.Builder passOwner(boolean passOwner)
Sets whether the owning object is passed to the hook.- Parameters:
passOwner- whether to pass the owner- Returns:
- this builder
-
passFieldName
public FieldWriteHook.Builder passFieldName(boolean passFieldName)
Sets whether the field name is passed to the hook.- Parameters:
passFieldName- whether to pass the field name- Returns:
- this builder
-
passNewValue
public FieldWriteHook.Builder passNewValue(boolean passNewValue)
Sets whether the value being written is passed to the hook.- Parameters:
passNewValue- whether to pass the new value- Returns:
- this builder
-
passOldValue
public FieldWriteHook.Builder passOldValue(boolean passOldValue)
Sets whether the previous field value is read and passed to the hook.- Parameters:
passOldValue- whether to pass the old value- Returns:
- this builder
-
canModifyValue
public FieldWriteHook.Builder canModifyValue(boolean canModifyValue)
Sets whether the hook's return value replaces the value written.- Parameters:
canModifyValue- whether the hook may substitute a value- Returns:
- this builder
-
instrumentStatic
public FieldWriteHook.Builder instrumentStatic(boolean instrumentStatic)
Sets whether PUTSTATIC sites are instrumented.- Parameters:
instrumentStatic- whether to instrument static writes- Returns:
- this builder
-
instrumentInstance
public FieldWriteHook.Builder instrumentInstance(boolean instrumentInstance)
Sets whether PUTFIELD sites are instrumented.- Parameters:
instrumentInstance- whether to instrument instance writes- Returns:
- this builder
-
build
public FieldWriteHook build()
- Returns:
- the configured hook
-
-