Class FieldWriteHook
- java.lang.Object
-
- com.tonic.analysis.instrumentation.hook.FieldWriteHook
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classFieldWriteHook.BuilderBuilder forFieldWriteHook, defaulting to enabled, priority 100, no values passed, and both static and instance writes instrumented.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static FieldWriteHook.Builderbuilder()List<InstrumentationFilter>getFilters()HookDescriptorgetHookDescriptor()intgetPriority()Gets the priority for ordering multiple hooks at the same point.InstrumentationTargetgetTarget()booleanisCanModifyValue()booleanisEnabled()booleanisInstrumentInstance()booleanisInstrumentStatic()booleanisPassFieldName()booleanisPassNewValue()booleanisPassOldValue()booleanisPassOwner()static FieldWriteHooksimple(String hookOwner, String hookName, String hookDescriptor)Creates a hook with default settings that calls a static method.
-
-
-
Method Detail
-
getHookDescriptor
public HookDescriptor getHookDescriptor()
- Specified by:
getHookDescriptorin interfaceHook- Returns:
- the hook descriptor
-
getFilters
public List<InstrumentationFilter> getFilters()
- Specified by:
getFiltersin interfaceHook- Returns:
- the filters
-
isEnabled
public boolean isEnabled()
-
getPriority
public int getPriority()
Description copied from interface:HookGets the priority for ordering multiple hooks at the same point.- Specified by:
getPriorityin interfaceHook- Returns:
- the priority
-
isPassOwner
public boolean isPassOwner()
- Returns:
- whether the field's owning object (null for static fields) is passed to the hook
-
isPassFieldName
public boolean isPassFieldName()
- Returns:
- whether the field name is passed to the hook
-
isPassNewValue
public boolean isPassNewValue()
- Returns:
- whether the new value being written (boxed if primitive) is passed to the hook
-
isPassOldValue
public boolean isPassOldValue()
- Returns:
- whether the old value (requires an additional load) is passed to the hook
-
isCanModifyValue
public boolean isCanModifyValue()
- Returns:
- whether the hook can replace the value being written (by returning a new one)
-
isInstrumentStatic
public boolean isInstrumentStatic()
- Returns:
- whether static field writes are instrumented
-
isInstrumentInstance
public boolean isInstrumentInstance()
- Returns:
- whether instance field writes are instrumented
-
getTarget
public InstrumentationTarget getTarget()
-
simple
public static FieldWriteHook simple(String hookOwner, String hookName, String hookDescriptor)
Creates a hook with default settings that calls a static method.- Parameters:
hookOwner- internal name of the class declaring the hook methodhookName- the hook method namehookDescriptor- the hook method descriptor- Returns:
- the configured hook
-
builder
public static FieldWriteHook.Builder builder()
- Returns:
- a new builder
-
-