Package com.tonic.analysis.query.ast
Class ClassScope
- java.lang.Object
-
- com.tonic.analysis.query.ast.ClassScope
-
-
Constructor Summary
Constructors Constructor Description ClassScope(String pattern, boolean isRegex)Creates a class scope.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> Taccept(ScopeVisitor<T> visitor)Dispatches to the visitor hook for this scope variant.booleanequals(Object o)static ClassScopeexact(String className)Creates a scope matching one exact class name.inthashCode()booleanisRegex()booleanmatches(String className)Tests a class name against this scope.Stringpattern()static ClassScoperegex(String pattern)Creates a scope matching class names against a regex.StringtoString()
-
-
-
Constructor Detail
-
ClassScope
public ClassScope(String pattern, boolean isRegex)
Creates a class scope.- Parameters:
pattern- the class name or regex to matchisRegex- whether pattern is a regular expression
-
-
Method Detail
-
pattern
public String pattern()
- Returns:
- the class name or regex pattern
-
isRegex
public boolean isRegex()
- Returns:
- whether the pattern is a regular expression
-
exact
public static ClassScope exact(String className)
Creates a scope matching one exact class name.- Parameters:
className- the internal class name to match- Returns:
- the exact-name scope
-
regex
public static ClassScope regex(String pattern)
Creates a scope matching class names against a regex.- Parameters:
pattern- the regular expression class names must match- Returns:
- the regex scope
-
matches
public boolean matches(String className)
Tests a class name against this scope.- Parameters:
className- the internal class name to test- Returns:
- true if the name matches the pattern
-
accept
public <T> T accept(ScopeVisitor<T> visitor)
Description copied from interface:ScopeDispatches to the visitor hook for this scope variant.
-
-