Class MethodEntryHook.Builder

  • Enclosing class:
    MethodEntryHook

    public static class MethodEntryHook.Builder
    extends Object
    Fluent builder for a method entry hook; every setting has a default except the hook descriptor.
    • Constructor Detail

      • Builder

        public Builder()
    • Method Detail

      • hookDescriptor

        public MethodEntryHook.Builder hookDescriptor​(HookDescriptor hookDescriptor)
        Sets the static method the hook calls.
        Parameters:
        hookDescriptor - the target hook method
        Returns:
        this builder
      • enabled

        public MethodEntryHook.Builder enabled​(boolean enabled)
        Sets whether the hook is applied at all; defaults to true.
        Parameters:
        enabled - true to apply the hook
        Returns:
        this builder
      • priority

        public MethodEntryHook.Builder priority​(int priority)
        Sets the ordering priority among hooks; defaults to 100.
        Parameters:
        priority - the priority value
        Returns:
        this builder
      • passThis

        public MethodEntryHook.Builder passThis​(boolean passThis)
        Sets whether the receiver is passed to the hook, null for static methods.
        Parameters:
        passThis - true to pass the receiver
        Returns:
        this builder
      • passMethodName

        public MethodEntryHook.Builder passMethodName​(boolean passMethodName)
        Sets whether the instrumented method's name is passed to the hook.
        Parameters:
        passMethodName - true to pass the method name
        Returns:
        this builder
      • passClassName

        public MethodEntryHook.Builder passClassName​(boolean passClassName)
        Sets whether the instrumented class's name is passed to the hook.
        Parameters:
        passClassName - true to pass the class name
        Returns:
        this builder
      • passAllParameters

        public MethodEntryHook.Builder passAllParameters​(boolean passAllParameters)
        Sets whether all parameters are passed as one Object array.
        Parameters:
        passAllParameters - true to pass every parameter
        Returns:
        this builder
      • parameterIndices

        public MethodEntryHook.Builder parameterIndices​(List<Integer> parameterIndices)
        Sets the individual parameter positions to pass, boxed when primitive.
        Parameters:
        parameterIndices - the parameter indices, replacing the current list
        Returns:
        this builder
      • build

        public MethodEntryHook build()
        Returns:
        a hook with the configured settings