Package com.google.errorprone.matchers
Class ChildMultiMatcher<T extends com.sun.source.tree.Tree,N extends com.sun.source.tree.Tree>
java.lang.Object
com.google.errorprone.matchers.ChildMultiMatcher<T,N>
- Type Parameters:
T
- the type of the node to match onN
- the type of the subnode that the given matcher should match
- All Implemented Interfaces:
Matcher<T>
,MultiMatcher<T,N>
,Serializable
- Direct Known Subclasses:
AnnotationMatcher
,ConstructorOfClass
,HasArguments
,MethodHasParameters
public abstract class ChildMultiMatcher<T extends com.sun.source.tree.Tree,N extends com.sun.source.tree.Tree> extends Object implements MultiMatcher<T,N>
A
MultiMatcher
that applies a matcher across multiple children of a single ancestor node.
Configurable to return true if any of, all of, or the last node matches. In the any or last of
cases, provides access to the node that matched.- Author:
- eaftan@google.com (Eddie Aftandilian)
- See Also:
- Serialized Form
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ChildMultiMatcher.MatchType
Nested classes/interfaces inherited from interface com.google.errorprone.matchers.MultiMatcher
MultiMatcher.MultiMatchResult<N extends com.sun.source.tree.Tree>
-
Field Summary
Fields Modifier and Type Field Description protected Matcher<N>
nodeMatcher
The matcher to apply to the subnodes in question. -
Constructor Summary
Constructors Constructor Description ChildMultiMatcher(ChildMultiMatcher.MatchType matchType, Matcher<N> nodeMatcher)
-
Method Summary
Modifier and Type Method Description protected abstract Iterable<? extends N>
getChildNodes(T tree, VisitorState state)
Returns the set of child nodes to match.boolean
matches(T tree, VisitorState state)
MultiMatcher.MultiMatchResult<N>
multiMatchResult(T tree, VisitorState state)
Attempt to match the given node, and return the associated subnodes that matched.
-
Field Details
-
nodeMatcher
The matcher to apply to the subnodes in question.
-
-
Constructor Details
-
ChildMultiMatcher
-
-
Method Details
-
matches
-
multiMatchResult
Description copied from interface:MultiMatcher
Attempt to match the given node, and return the associated subnodes that matched.- Specified by:
multiMatchResult
in interfaceMultiMatcher<T extends com.sun.source.tree.Tree,N extends com.sun.source.tree.Tree>
-
getChildNodes
Returns the set of child nodes to match. The nodes must be immediate children of the current node to ensure the TreePath calculation is correct. MultiMatchers with other requirements should not subclass ChildMultiMatcher.
-