Class MethodExitHook

  • All Implemented Interfaces:
    Hook

    public class MethodExitHook
    extends Object
    implements Hook
    Configuration for method exit instrumentation.
    • Method Detail

      • isEnabled

        public boolean isEnabled()
        Specified by:
        isEnabled in interface Hook
        Returns:
        whether enabled
      • getPriority

        public int getPriority()
        Description copied from interface: Hook
        Gets the priority for ordering multiple hooks at the same point.
        Specified by:
        getPriority in interface Hook
        Returns:
        the priority
      • isPassThis

        public boolean isPassThis()
        Returns:
        whether the this reference (null for static methods) is passed to the hook
      • isPassMethodName

        public boolean isPassMethodName()
        Returns:
        whether the method name is passed to the hook
      • isPassClassName

        public boolean isPassClassName()
        Returns:
        whether the class name is passed to the hook
      • isPassReturnValue

        public boolean isPassReturnValue()
        Returns:
        whether the return value (boxed if primitive, null for void) is passed to the hook
      • isCanModifyReturn

        public boolean isCanModifyReturn()
        Returns:
        whether the hook can replace the return value (by returning a new one)
      • isInstrumentExceptionalExits

        public boolean isInstrumentExceptionalExits()
        Returns:
        whether exceptional exits (in finally blocks) are instrumented
      • simple

        public static MethodExitHook 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 method
        hookName - the hook method name
        hookDescriptor - the hook method descriptor
        Returns:
        the configured hook