Interface ExpressionChildrenMatcher
-
- All Known Implementing Classes:
AllChildrenMatcher
,AnyChildMatcher
,AnyChildrenMatcher
,AnyChildWithRestMatcher
,ListChildrenMatcher
@API(EXPERIMENTAL) public interface ExpressionChildrenMatcher
AnExpressionChildrenMatcher
describes how to match the children of aRelationalExpression
(i.e., the references returned by theRelationalExpression.getQuantifiers()
method). Bindings can be retrieved from the rule call using theExpressionChildMatcher
that produced them.In most cases, the most natural way to bind to the children of a planner expression is by defining a matcher for each child. This behavior is implemented in the
ListChildrenMatcher
and exposed by theTypeMatcher.of(Class, ExpressionMatcher[])
helper method. However, this does not work when there is no a priori bound on the number of children returned byRelationalExpression.getQuantifiers()
For example, anAndComponent
can have an arbitrary number of otherQueryComponent
s as children.Note that an
ExpressionChildrenMatcher
should generally only define how to distribute children to one or more child matchers, and that these child matchers should generally match to the children themselves. For example, see the implementation ofListChildrenMatcher
. Extreme care should be taken when implementing anExpressionChildrenMatcher
. In particular, expression matchers may (or may not) be reused between successive rule calls and should be stateless. Additionally, implementors ofExpressionMatcher
must use the (default) referenceequals()
method.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Stream<PlannerBindings>
matches(List<? extends Bindable> children)
Apply this matcher to the children provided by the given iterator and produce a stream of possible bindings.
-
-
-
Method Detail
-
matches
@Nonnull Stream<PlannerBindings> matches(@Nonnull List<? extends Bindable> children)
Apply this matcher to the children provided by the given iterator and produce a stream of possible bindings. If the match is not successful, produce an empty stream. Note that this method should not generally match to the children themselves; instead, it should delegate that work to one or more innerExpressionMatcher
s.- Parameters:
children
- a list of references to the children of a planner expression- Returns:
- a stream of the possible bindings from applying this match to the children in the given iterator
-
-