Class Instrumenter.MethodCallHookBuilder

  • Enclosing class:
    Instrumenter

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

      • inClass

        public Instrumenter.MethodCallHookBuilder inClass​(String className)
        Restricts this hook to call sites in a single class.
        Parameters:
        className - the internal class name
        Returns:
        this builder
      • inPackage

        public Instrumenter.MethodCallHookBuilder inPackage​(String packagePrefix)
        Restricts this hook to call sites under a package.
        Parameters:
        packagePrefix - the internal package name prefix
        Returns:
        this builder
      • targeting

        public Instrumenter.MethodCallHookBuilder targeting​(String targetClass,
                                                            String targetMethod)
        Restricts this hook to calls of one method, whatever its descriptor.
        Parameters:
        targetClass - internal name of the called class
        targetMethod - the called method name
        Returns:
        this builder
      • targeting

        public Instrumenter.MethodCallHookBuilder targeting​(String targetClass,
                                                            String targetMethod,
                                                            String targetDescriptor)
        Restricts this hook to calls of one exact method signature.
        Parameters:
        targetClass - internal name of the called class
        targetMethod - the called method name
        targetDescriptor - the called method descriptor
        Returns:
        this builder
      • callStatic

        public Instrumenter.MethodCallHookBuilder 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
      • priority

        public Instrumenter.MethodCallHookBuilder 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