Class ListChildrenMatcher
- java.lang.Object
-
- com.apple.foundationdb.record.query.plan.temp.matchers.ListChildrenMatcher
-
- All Implemented Interfaces:
ExpressionChildrenMatcher
public class ListChildrenMatcher extends Object implements ExpressionChildrenMatcher
A matcher for a children that tries to match each child to a specified matcher. It implements the "default" matching for children, as exposed by theTypeMatcher.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.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ListChildrenMatcher
empty()
Get a matcher with no child matchers which matches an empty collection of children.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.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 ofExpressionMatcher
s.
-
-
-
Method Detail
-
matches
@Nonnull public Stream<PlannerBindings> matches(@Nonnull List<? extends Bindable> children)
Description copied from interface:ExpressionChildrenMatcher
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.- Specified by:
matches
in interfaceExpressionChildrenMatcher
- 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
-
empty
@Nonnull public static ListChildrenMatcher empty()
Get a matcher with no child matchers which matches an empty collection of children. The returned matcher may be a static instance and may not be distinct across different calls. Unlike anExpressionMatcher
, anExpressionChildrenMatcher
is not used for creating bindings and so need not be a distinct object.- Returns:
- a matcher that matches an empty collection of children
-
of
@Nonnull public 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 ofExpressionMatcher
s.- Parameters:
childMatchers
- a list of matcher for the children, in order- Returns:
- a matcher that attempts to match the children, in order, to the given list of matchers
-
-