Class ExceptionHook
- java.lang.Object
-
- com.tonic.analysis.instrumentation.hook.ExceptionHook
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classExceptionHook.BuilderFluent builder forExceptionHookinstances.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ExceptionHook.Builderbuilder()Creates a builder for an exception hook.static ExceptionHookforType(String exceptionType, String hookOwner, String hookName, String hookDescriptor)Creates an exception hook restricted to a specific exception type.StringgetExceptionType()List<InstrumentationFilter>getFilters()HookDescriptorgetHookDescriptor()intgetPriority()Gets the priority for ordering multiple hooks at the same point.InstrumentationTargetgetTarget()booleanisCanSuppress()booleanisEnabled()booleanisPassClassName()booleanisPassException()booleanisPassMethodName()static ExceptionHooksimple(String hookOwner, String hookName, String hookDescriptor)Creates an exception hook that invokes the given static hook method for all exception types.
-
-
-
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
-
getExceptionType
public String getExceptionType()
- Returns:
- the exception type to intercept (internal name), or null for all types
-
isPassException
public boolean isPassException()
- Returns:
- whether the exception object is passed to the hook
-
isPassMethodName
public boolean isPassMethodName()
- Returns:
- whether the name of the method where the exception occurred is passed to the hook
-
isPassClassName
public boolean isPassClassName()
- Returns:
- whether the name of the class where the exception occurred is passed to the hook
-
isCanSuppress
public boolean isCanSuppress()
- Returns:
- whether the hook can suppress the exception by returning true
-
getTarget
public InstrumentationTarget getTarget()
-
simple
public static ExceptionHook simple(String hookOwner, String hookName, String hookDescriptor)
Creates an exception hook that invokes the given static hook method for all exception types.- Parameters:
hookOwner- the hook method's owning class (internal name)hookName- the hook method namehookDescriptor- the hook method descriptor- Returns:
- the new hook
-
forType
public static ExceptionHook forType(String exceptionType, String hookOwner, String hookName, String hookDescriptor)
Creates an exception hook restricted to a specific exception type.- Parameters:
exceptionType- the exception type to intercept (internal name)hookOwner- the hook method's owning class (internal name)hookName- the hook method namehookDescriptor- the hook method descriptor- Returns:
- the new hook
-
builder
public static ExceptionHook.Builder builder()
Creates a builder for an exception hook.- Returns:
- a new builder
-
-