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:
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.google.errorprone.matchers.MultiMatcher
MultiMatcher.MultiMatchResult<N extends com.sun.source.tree.Tree>
-
Field Summary
Modifier and TypeFieldDescriptionThe matcher to apply to the subnodes in question. -
Constructor Summary
ConstructorDescriptionChildMultiMatcher
(ChildMultiMatcher.MatchType matchType, Matcher<N> nodeMatcher) -
Method Summary
Modifier and TypeMethodDescriptiongetChildNodes
(T tree, VisitorState state) Returns the set of child nodes to match.boolean
matches
(T tree, VisitorState state) multiMatchResult
(T tree, VisitorState state) Attempt to match the given node, and return the associated subnodes that matched.
-
Field Details
-
nodeMatcher
-
-
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.
-