Class ClassFilter
- java.lang.Object
-
- com.tonic.analysis.instrumentation.filter.ClassFilter
-
- All Implemented Interfaces:
InstrumentationFilter
public class ClassFilter extends Object implements InstrumentationFilter
An instrumentation filter that selects classes by exact name or glob pattern.
-
-
Constructor Summary
Constructors Constructor Description ClassFilter(String pattern)Creates a class filter with the given pattern.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ClassFilterexact(String className)Creates a filter that matches a single class exactly.StringgetPattern()PatterngetRegex()booleanisWildcard()booleanmatchesClass(ClassFile classFile)Checks if the given class matches this filter.static ClassFiltermatching(String pattern)Creates a filter that matches classes using a wildcard pattern.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
matchesField, matchesMethod, matchesMethodCall
-
-
-
-
Constructor Detail
-
ClassFilter
public ClassFilter(String pattern)
Creates a class filter with the given pattern.- Parameters:
pattern- the class name pattern (internal format, e.g., "com/example/MyClass") Use '*' for wildcards (e.g., "com/example/*" or "com/example/**")
-
-
Method Detail
-
getPattern
public String getPattern()
- Returns:
- the pattern
-
isWildcard
public boolean isWildcard()
- Returns:
- whether wildcard
-
getRegex
public Pattern getRegex()
- Returns:
- the regex
-
matchesClass
public boolean matchesClass(ClassFile classFile)
Description copied from interface:InstrumentationFilterChecks if the given class matches this filter.- Specified by:
matchesClassin interfaceInstrumentationFilter- Parameters:
classFile- the class file to check- Returns:
- true if the class matches, false otherwise
-
exact
public static ClassFilter exact(String className)
Creates a filter that matches a single class exactly.- Parameters:
className- the class name, in either dotted or internal form- Returns:
- the filter
-
matching
public static ClassFilter matching(String pattern)
Creates a filter that matches classes using a wildcard pattern.- Parameters:
pattern- the glob pattern, where '*' stays within one path segment and '**' spans segments- Returns:
- the filter
-
-