Class MethodFilter

    • Constructor Detail

      • MethodFilter

        public MethodFilter​(String namePattern)
        Creates a method filter matching by name.
        Parameters:
        namePattern - the method name pattern (use '*' for wildcards)
      • MethodFilter

        public MethodFilter​(String namePattern,
                            String descriptorPattern)
        Creates a method filter matching by name and descriptor.
        Parameters:
        namePattern - the method name pattern
        descriptorPattern - the descriptor pattern (null to match any)
    • Method Detail

      • getNamePattern

        public String getNamePattern()
        Returns:
        the name pattern
      • getDescriptorPattern

        public String getDescriptorPattern()
        Returns:
        the descriptor pattern
      • isWildcard

        public boolean isWildcard()
        Returns:
        whether wildcard
      • getNameRegex

        public Pattern getNameRegex()
        Returns:
        the name regex
      • getDescriptorRegex

        public Pattern getDescriptorRegex()
        Returns:
        the descriptor regex
      • matchesMethod

        public boolean matchesMethod​(MethodEntry method)
        Description copied from interface: InstrumentationFilter
        Checks if the given method matches this filter.
        Specified by:
        matchesMethod in interface InstrumentationFilter
        Parameters:
        method - the method entry to check
        Returns:
        true if the method matches, false otherwise
      • named

        public static MethodFilter named​(String name)
        Creates a filter matching an exact method name.
        Parameters:
        name - the method name to match
        Returns:
        the filter
      • startingWith

        public static MethodFilter startingWith​(String prefix)
        Creates a filter matching methods starting with a prefix.
        Parameters:
        prefix - the required name prefix
        Returns:
        the filter
      • endingWith

        public static MethodFilter endingWith​(String suffix)
        Creates a filter matching methods ending with a suffix.
        Parameters:
        suffix - the required name suffix
        Returns:
        the filter
      • containing

        public static MethodFilter containing​(String substring)
        Creates a filter matching methods containing a substring.
        Parameters:
        substring - the substring the name must contain
        Returns:
        the filter
      • matching

        public static MethodFilter matching​(String pattern)
        Creates a filter matching methods by pattern (wildcard support).
        Parameters:
        pattern - the name pattern, where * matches any run of characters
        Returns:
        the filter
      • signature

        public static MethodFilter signature​(String name,
                                             String descriptor)
        Creates a filter matching a specific method signature.
        Parameters:
        name - the method name pattern
        descriptor - the method descriptor pattern
        Returns:
        the filter