Class Instrumenter.MethodEntryHookBuilder

  • Enclosing class:
    Instrumenter

    public static class Instrumenter.MethodEntryHookBuilder
    extends Object
    Fluent builder for a method entry hook.
    • Method Detail

      • inClassMatching

        public Instrumenter.MethodEntryHookBuilder inClassMatching​(String pattern)
        Restricts this hook to classes whose name matches a pattern.
        Parameters:
        pattern - the class name pattern
        Returns:
        this builder
      • inPackage

        public Instrumenter.MethodEntryHookBuilder inPackage​(String packagePrefix)
        Restricts this hook to classes under a package.
        Parameters:
        packagePrefix - the internal package name prefix
        Returns:
        this builder
      • matchingMethod

        public Instrumenter.MethodEntryHookBuilder matchingMethod​(String pattern)
        Restricts this hook to methods whose name matches a pattern.
        Parameters:
        pattern - the method name pattern
        Returns:
        this builder
      • withAnnotation

        public Instrumenter.MethodEntryHookBuilder withAnnotation​(String annotationType)
        Restricts this hook to methods carrying an annotation.
        Parameters:
        annotationType - the annotation type
        Returns:
        this builder
      • callStatic

        public Instrumenter.MethodEntryHookBuilder callStatic​(String owner,
                                                              String name,
                                                              String descriptor)
        Sets the static method the hook dispatches to.
        Parameters:
        owner - internal name of the class declaring the hook method
        name - the hook method name
        descriptor - the hook method descriptor
        Returns:
        this builder
      • withAllParameters

        public Instrumenter.MethodEntryHookBuilder withAllParameters()
        Passes every parameter of the instrumented method as hook arguments.
        Returns:
        this builder
      • priority

        public Instrumenter.MethodEntryHookBuilder priority​(int priority)
        Sets the ordering priority of this hook against others at the same site.
        Parameters:
        priority - the priority value
        Returns:
        this builder
      • register

        public Instrumenter register()
        Attaches the collected filters and registers the hook.
        Returns:
        the instrumenter this builder came from