Class MethodExitHook.Builder

  • Enclosing class:
    MethodExitHook

    public static class MethodExitHook.Builder
    extends Object
    Builder for MethodExitHook, defaulting to enabled, priority 100, no values passed and normal returns only.
    • Constructor Detail

      • Builder

        public Builder()
    • Method Detail

      • hookDescriptor

        public MethodExitHook.Builder hookDescriptor​(HookDescriptor hookDescriptor)
        Sets the method the instrumentation will call.
        Parameters:
        hookDescriptor - the hook method descriptor
        Returns:
        this builder
      • enabled

        public MethodExitHook.Builder enabled​(boolean enabled)
        Sets whether the hook is applied at all.
        Parameters:
        enabled - whether the hook is active
        Returns:
        this builder
      • priority

        public MethodExitHook.Builder priority​(int priority)
        Sets the ordering weight against other hooks on the same site.
        Parameters:
        priority - the priority value
        Returns:
        this builder
      • passThis

        public MethodExitHook.Builder passThis​(boolean passThis)
        Sets whether the this reference is passed to the hook.
        Parameters:
        passThis - whether to pass the receiver
        Returns:
        this builder
      • passMethodName

        public MethodExitHook.Builder passMethodName​(boolean passMethodName)
        Sets whether the enclosing method name is passed to the hook.
        Parameters:
        passMethodName - whether to pass the method name
        Returns:
        this builder
      • passClassName

        public MethodExitHook.Builder passClassName​(boolean passClassName)
        Sets whether the enclosing class name is passed to the hook.
        Parameters:
        passClassName - whether to pass the class name
        Returns:
        this builder
      • passReturnValue

        public MethodExitHook.Builder passReturnValue​(boolean passReturnValue)
        Sets whether the returned value is passed to the hook.
        Parameters:
        passReturnValue - whether to pass the return value
        Returns:
        this builder
      • canModifyReturn

        public MethodExitHook.Builder canModifyReturn​(boolean canModifyReturn)
        Sets whether the hook's return value replaces the value returned.
        Parameters:
        canModifyReturn - whether the hook may substitute a return value
        Returns:
        this builder
      • instrumentExceptionalExits

        public MethodExitHook.Builder instrumentExceptionalExits​(boolean instrumentExceptionalExits)
        Sets whether exits by thrown exception are hooked as well as returns.
        Parameters:
        instrumentExceptionalExits - whether to instrument exceptional exits
        Returns:
        this builder