public class ListChildrenMatcher extends Object implements ExpressionChildrenMatcher
TypeMatcher.of(Class, ExpressionMatcher[])
helper method.
If every child matches the specified matcher and if every matcher matches a child, the ListChildrenMatcher
returns a stream of bindings that includes the Cartesian product of the stream of bindings from each child. Note that
this matcher can only match a fixed number of children. Currently, matching is not especially efficient: the cross
product is computed by collecting each child stream into a list.
Modifier and Type | Method and Description |
---|---|
static ListChildrenMatcher |
empty()
Get a matcher with no child matchers which matches an empty collection of children.
|
Stream<PlannerBindings> |
matches(Iterator<? extends ExpressionRef<? extends PlannerExpression>> childIterator)
Apply this matcher to the children provided by the given iterator and produce a stream of possible bindings.
|
static ListChildrenMatcher |
of(List<ExpressionMatcher<? extends Bindable>> childMatchers)
Get a matcher that tries to match the planner expression children, in order, to the given list of
ExpressionMatcher s. |
@Nonnull public Stream<PlannerBindings> matches(@Nonnull Iterator<? extends ExpressionRef<? extends PlannerExpression>> childIterator)
ExpressionChildrenMatcher
ExpressionMatcher
s.matches
in interface ExpressionChildrenMatcher
childIterator
- an iterator of references to the children of a planner expression@Nonnull public static ListChildrenMatcher empty()
ExpressionMatcher
,
an ExpressionChildrenMatcher
is not used for creating bindings and so need not be a distinct object.@Nonnull public static ListChildrenMatcher of(List<ExpressionMatcher<? extends Bindable>> childMatchers)
ExpressionMatcher
s.childMatchers
- a list of matcher for the children, in order