Class FieldFilter
- java.lang.Object
-
- com.tonic.analysis.instrumentation.filter.FieldFilter
-
- All Implemented Interfaces:
InstrumentationFilter
public class FieldFilter extends Object implements InstrumentationFilter
Filter by field name and/or type pattern.
-
-
Constructor Summary
Constructors Constructor Description FieldFilter(String namePattern)Creates a field filter matching by name only.FieldFilter(String ownerPattern, String namePattern, String typePattern)Creates a field filter with full pattern support.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static FieldFilterforField(String name)Creates a filter matching a field by name.StringgetNamePattern()PatterngetNameRegex()StringgetOwnerPattern()PatterngetOwnerRegex()StringgetTypePattern()PatterngetTypeRegex()static FieldFilterinClass(String ownerClass)Creates a filter matching all fields in a specific class.booleanmatchesField(String owner, String name, String descriptor)Checks if the given field matches this filter.static FieldFiltermatching(String pattern)Creates a filter matching fields by pattern (wildcard support).static FieldFilternamed(String name)Creates a filter matching an exact field name.static FieldFilterofType(String typeDescriptor)Creates a filter matching fields of a specific type.static FieldFilterspecific(String owner, String name)Creates a filter matching a specific field.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, matchesMethod, matchesMethodCall
-
-
-
-
Constructor Detail
-
FieldFilter
public FieldFilter(String namePattern)
Creates a field filter matching by name only.- Parameters:
namePattern- the field name pattern (use '*' for wildcards)
-
FieldFilter
public FieldFilter(String ownerPattern, String namePattern, String typePattern)
Creates a field filter with full pattern support.- Parameters:
ownerPattern- the owner class pattern (null for any)namePattern- the field name pattern (null for any)typePattern- the type descriptor pattern (null for any)
-
-
Method Detail
-
getOwnerPattern
public String getOwnerPattern()
- Returns:
- the owner pattern
-
getNamePattern
public String getNamePattern()
- Returns:
- the name pattern
-
getTypePattern
public String getTypePattern()
- Returns:
- the type pattern
-
getOwnerRegex
public Pattern getOwnerRegex()
- Returns:
- the owner regex
-
getNameRegex
public Pattern getNameRegex()
- Returns:
- the name regex
-
getTypeRegex
public Pattern getTypeRegex()
- Returns:
- the type regex
-
matchesField
public boolean matchesField(String owner, String name, String descriptor)
Description copied from interface:InstrumentationFilterChecks if the given field matches this filter.- Specified by:
matchesFieldin interfaceInstrumentationFilter- Parameters:
owner- the class owning the field (internal name)name- the field namedescriptor- the field type descriptor- Returns:
- true if the field matches, false otherwise
-
named
public static FieldFilter named(String name)
Creates a filter matching an exact field name.- Parameters:
name- the field name to match- Returns:
- a filter constrained to that name
-
forField
public static FieldFilter forField(String name)
Creates a filter matching a field by name.- Parameters:
name- the field name to match- Returns:
- a filter constrained to that name
-
matching
public static FieldFilter matching(String pattern)
Creates a filter matching fields by pattern (wildcard support).- Parameters:
pattern- the field name pattern, where '*' matches any run of characters- Returns:
- a filter constrained to names matching the pattern
-
ofType
public static FieldFilter ofType(String typeDescriptor)
Creates a filter matching fields of a specific type.- Parameters:
typeDescriptor- the field descriptor pattern, where '*' matches any run of characters- Returns:
- a filter constrained to that descriptor
-
inClass
public static FieldFilter inClass(String ownerClass)
Creates a filter matching all fields in a specific class.- Parameters:
ownerClass- the owner pattern, where '*' matches any run of characters- Returns:
- a filter constrained to that owner
-
specific
public static FieldFilter specific(String owner, String name)
Creates a filter matching a specific field.- Parameters:
owner- the owner patternname- the field name pattern- Returns:
- a filter constrained to that owner and name
-
-