Class MethodFilter
- java.lang.Object
-
- com.tonic.analysis.instrumentation.filter.MethodFilter
-
- All Implemented Interfaces:
InstrumentationFilter
public class MethodFilter extends Object implements InstrumentationFilter
Filter by method name pattern.
-
-
Constructor Summary
Constructors Constructor Description MethodFilter(String namePattern)Creates a method filter matching by name.MethodFilter(String namePattern, String descriptorPattern)Creates a method filter matching by name and descriptor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static MethodFiltercontaining(String substring)Creates a filter matching methods containing a substring.static MethodFilterendingWith(String suffix)Creates a filter matching methods ending with a suffix.StringgetDescriptorPattern()PatterngetDescriptorRegex()StringgetNamePattern()PatterngetNameRegex()booleanisWildcard()booleanmatchesMethod(MethodEntry method)Checks if the given method matches this filter.static MethodFiltermatching(String pattern)Creates a filter matching methods by pattern (wildcard support).static MethodFilternamed(String name)Creates a filter matching an exact method name.static MethodFiltersignature(String name, String descriptor)Creates a filter matching a specific method signature.static MethodFilterstartingWith(String prefix)Creates a filter matching methods starting with a prefix.StringtoString()-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.tonic.analysis.instrumentation.filter.InstrumentationFilter
matchesClass, matchesField, matchesMethodCall
-
-
-
-
Constructor Detail
-
MethodFilter
public MethodFilter(String namePattern)
Creates a method filter matching by name.- Parameters:
namePattern- the method name pattern (use '*' for wildcards)
-
-
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:InstrumentationFilterChecks if the given method matches this filter.- Specified by:
matchesMethodin interfaceInstrumentationFilter- 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 patterndescriptor- the method descriptor pattern- Returns:
- the filter
-
-