Class PackageFilter
- java.lang.Object
-
- com.tonic.analysis.instrumentation.filter.PackageFilter
-
- All Implemented Interfaces:
InstrumentationFilter
public class PackageFilter extends Object implements InstrumentationFilter
Instrumentation filter matching classes by package prefix.
-
-
Constructor Summary
Constructors Constructor Description PackageFilter(String packagePrefix)Creates a package filter.PackageFilter(String packagePrefix, boolean includeSubpackages)Creates a package filter.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static PackageFilterexactPackage(String packageName)Creates a filter for one package, excluding its subpackages.static PackageFilterforPackage(String packageName)Creates a filter for a package and all its subpackages; alias forof(String).StringgetPackagePrefix()booleanisIncludeSubpackages()booleanmatchesClass(ClassFile classFile)Checks if the given class matches this filter.static PackageFilterof(String packageName)Creates a filter for a package and all its subpackages.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
-
PackageFilter
public PackageFilter(String packagePrefix)
Creates a package filter.- Parameters:
packagePrefix- the package prefix (internal format, e.g., "com/example/")
-
PackageFilter
public PackageFilter(String packagePrefix, boolean includeSubpackages)
Creates a package filter.- Parameters:
packagePrefix- the package prefix (internal format)includeSubpackages- whether to include subpackages
-
-
Method Detail
-
getPackagePrefix
public String getPackagePrefix()
- Returns:
- the package prefix
-
isIncludeSubpackages
public boolean isIncludeSubpackages()
- Returns:
- whether include subpackages
-
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
-
of
public static PackageFilter of(String packageName)
Creates a filter for a package and all its subpackages.- Parameters:
packageName- package name in either dotted or internal form- Returns:
- the filter
-
forPackage
public static PackageFilter forPackage(String packageName)
Creates a filter for a package and all its subpackages; alias forof(String).- Parameters:
packageName- package name in either dotted or internal form- Returns:
- the filter
-
exactPackage
public static PackageFilter exactPackage(String packageName)
Creates a filter for one package, excluding its subpackages.- Parameters:
packageName- package name in either dotted or internal form- Returns:
- the filter
-
-