Class MethodEntryHook
- java.lang.Object
-
- com.tonic.analysis.instrumentation.hook.MethodEntryHook
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMethodEntryHook.BuilderFluent builder for a method entry hook; every setting has a default except the hook descriptor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static MethodEntryHook.Builderbuilder()List<InstrumentationFilter>getFilters()HookDescriptorgetHookDescriptor()List<Integer>getParameterIndices()intgetPriority()Gets the priority for ordering multiple hooks at the same point.InstrumentationTargetgetTarget()booleanisEnabled()booleanisPassAllParameters()booleanisPassClassName()booleanisPassMethodName()booleanisPassThis()static MethodEntryHooksimple(String hookOwner, String hookName, String hookDescriptor)Creates a hook that calls a static method with no filters and no extra arguments.
-
-
-
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
-
isPassThis
public boolean isPassThis()
- Returns:
- true if the receiver, null for static methods, is passed to the hook
-
isPassMethodName
public boolean isPassMethodName()
- Returns:
- true if the instrumented method's name is passed to the hook
-
isPassClassName
public boolean isPassClassName()
- Returns:
- true if the instrumented class's name is passed to the hook
-
isPassAllParameters
public boolean isPassAllParameters()
- Returns:
- true if every parameter is passed to the hook as one Object array
-
getParameterIndices
public List<Integer> getParameterIndices()
- Returns:
- the individual parameter positions to pass, boxed when primitive
-
getTarget
public InstrumentationTarget getTarget()
-
simple
public static MethodEntryHook simple(String hookOwner, String hookName, String hookDescriptor)
Creates a hook that calls a static method with no filters and no extra arguments.- Parameters:
hookOwner- the internal name of the class declaring the hook methodhookName- the hook method namehookDescriptor- the hook method descriptor- Returns:
- the configured hook
-
builder
public static MethodEntryHook.Builder builder()
- Returns:
- a new builder with default settings
-
-