Package com.tonic.analysis.query.ast
Class MethodScope
- java.lang.Object
-
- com.tonic.analysis.query.ast.MethodScope
-
-
Constructor Summary
Constructors Constructor Description MethodScope(String pattern, boolean isRegex)Creates a method 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 MethodScopeexact(String signature)Creates a scope matching one exact method signature.inthashCode()booleanisRegex()booleanmatches(String methodSignature)Tests a method signature against this scope.Stringpattern()static MethodScoperegex(String pattern)Creates a scope matching method signatures against a regex.StringtoString()
-
-
-
Constructor Detail
-
MethodScope
public MethodScope(String pattern, boolean isRegex)
Creates a method scope.- Parameters:
pattern- the method signature or regex to matchisRegex- whether pattern is a regular expression
-
-
Method Detail
-
pattern
public String pattern()
- Returns:
- the method signature or regex pattern
-
isRegex
public boolean isRegex()
- Returns:
- whether the pattern is a regular expression
-
exact
public static MethodScope exact(String signature)
Creates a scope matching one exact method signature.- Parameters:
signature- the method signature to match- Returns:
- the exact-signature scope
-
regex
public static MethodScope regex(String pattern)
Creates a scope matching method signatures against a regex.- Parameters:
pattern- the regular expression signatures must match- Returns:
- the regex scope
-
matches
public boolean matches(String methodSignature)
Tests a method signature against this scope.- Parameters:
methodSignature- the signature to test- Returns:
- true if the signature matches the pattern
-
accept
public <T> T accept(ScopeVisitor<T> visitor)
Description copied from interface:ScopeDispatches to the visitor hook for this scope variant.
-
-