An API for
QueryPart.$traverse(Traverser)
query part traversals.
This API is EXPERIMENTAL. Use at your own risk.
Similar to a Collector
for Stream.collect(Collector)
, this
type wraps:
-
Method Summary
Modifier and TypeMethodDescriptionabort()
An optional traversal abort condition to short circuit traversal e.g.after()
A callback that is invoked after recursing into a subtree.before()
A callback that is invoked before recursing into a subtree.finisher()
An optional transformation function to turn the temporary data structure supplied bysupplier()
into the final data structure.static <A,
R> Traverser <A, R> of
(Supplier<A> supplier, Predicate<? super A> abort, Predicate<? super QueryPart> recurse, BiFunction<? super A, ? super QueryPart, ? extends A> before, BiFunction<? super A, ? super QueryPart, ? extends A> after, Function<? super A, ? extends R> finisher) Convenience method to create aTraverser
with asupplier()
,abort()
,recurse()
,before()
,after()
, andfinisher()
.static <A,
R> Traverser <A, R> of
(Supplier<A> supplier, Predicate<? super A> abort, Predicate<? super QueryPart> recurse, Predicate<? super QueryPart> recurseChildren, BiFunction<? super A, ? super QueryPart, ? extends A> before, BiFunction<? super A, ? super QueryPart, ? extends A> after, Function<? super A, ? extends R> finisher) Convenience method to create aTraverser
with asupplier()
,abort()
,recurse()
,recurseChildren()
,before()
,after()
, andfinisher()
.static <R> Traverser
<R, R> of
(Supplier<R> supplier, BiFunction<? super R, ? super QueryPart, ? extends R> before) static <R> Traverser
<R, R> of
(Supplier<R> supplier, BiFunction<? super R, ? super QueryPart, ? extends R> before, BiFunction<? super R, ? super QueryPart, ? extends R> after) static <R> Traverser
<R, R> of
(Supplier<R> supplier, Predicate<? super R> abort, Predicate<? super QueryPart> recurse, BiFunction<? super R, ? super QueryPart, ? extends R> before) static <R> Traverser
<R, R> of
(Supplier<R> supplier, Predicate<? super R> abort, Predicate<? super QueryPart> recurse, BiFunction<? super R, ? super QueryPart, ? extends R> before, BiFunction<? super R, ? super QueryPart, ? extends R> after) recurse()
An optional recursion condition to prevent entering a specificQueryPart
, e.g.An optional recursion condition to prevent entering a specificQueryPart
's children, e.g.supplier()
A supplier for a temporary data structure to accumulateQueryPart
objects into during traversal.
-
Method Details
-
of
static <R> Traverser<R,R> of(Supplier<R> supplier, BiFunction<? super R, ? super QueryPart, ? extends R> before) -
of
static <R> Traverser<R,R> of(Supplier<R> supplier, BiFunction<? super R, ? super QueryPart, ? extends R> before, BiFunction<? super R, ? super QueryPart, ? extends R> after) -
of
-
of
static <R> Traverser<R,R> of(Supplier<R> supplier, Predicate<? super R> abort, Predicate<? super QueryPart> recurse, BiFunction<? super R, ? super QueryPart, ? extends R> before, BiFunction<? super R, ? super QueryPart, ? extends R> after) -
of
static <A,R> Traverser<A,R> of(Supplier<A> supplier, Predicate<? super A> abort, Predicate<? super QueryPart> recurse, BiFunction<? super A, ? super QueryPart, ? extends A> before, BiFunction<? super A, ? super QueryPart, ? extends A> after, Function<? super A, ? extends R> finisher) Convenience method to create aTraverser
with asupplier()
,abort()
,recurse()
,before()
,after()
, andfinisher()
. -
of
static <A,R> Traverser<A,R> of(Supplier<A> supplier, Predicate<? super A> abort, Predicate<? super QueryPart> recurse, Predicate<? super QueryPart> recurseChildren, BiFunction<? super A, ? super QueryPart, ? extends A> before, BiFunction<? super A, ? super QueryPart, ? extends A> after, Function<? super A, ? extends R> finisher) Convenience method to create aTraverser
with asupplier()
,abort()
,recurse()
,recurseChildren()
,before()
,after()
, andfinisher()
. -
supplier
A supplier for a temporary data structure to accumulateQueryPart
objects into during traversal. -
abort
An optional traversal abort condition to short circuit traversal e.g. when the searched object has been found. -
recurse
An optional recursion condition to prevent entering a specificQueryPart
, e.g. when it is undesired to enter any subqueries. -
recurseChildren
An optional recursion condition to prevent entering a specificQueryPart
's children, e.g. when it is desired to traverse only into certain operators. -
before
BiFunction<A,QueryPart, before()A> A callback that is invoked before recursing into a subtree. -
after
BiFunction<A,QueryPart, after()A> A callback that is invoked after recursing into a subtree. -
finisher
An optional transformation function to turn the temporary data structure supplied bysupplier()
into the final data structure.
-