/** * Appends the filters as query fragments determined by the last call to {@link #filter()} or {@link #path()}. * * <p>The filters is an array of arrays representing a new set of branches to be created at all the leaves of * the current query tree. * * @param filters the filters to append to the leaves of the query tree * @return this instance */ public SymmetricExtender with(Filter[][] filters) { onLeaves(this.filters, (builder) -> { for (Filter[] fs : filters) { builder.branch().with(queryFragmentSupplier.apply(fs)); } }); return this; }
/** * Proceeds the traversal to the next entities taking into account what parents the next entities should have. * * @param nextEntityType the type of the entities the new context will target * @param parentsType the type of the enum containing the possible parent types * @param currentParent the parent type representing the current position in the traversal * @param parents the parents to proceed to target entities over * @param hopBuilder the producer function that will convert the parent into a filter path to apply to the * traversal * @param <T> the type of the next entity * @param <P> the type of the enum of the possible parents of the target entity * @return a new traversal context */ <T extends Entity<?, ?>, P extends Enum<P> & Parents> TraversalContext<BE, T> proceedWithParents(Class<T> nextEntityType, Class<P> parentsType, P currentParent, P[] parents, BiConsumer<P, Query.SymmetricExtender> hopBuilder) { EnumSet<P> ps = ParentsUtil.convert(parentsType, currentParent, parents); TraversalContext.Builder<BE, E> bld = proceed(); for (P p : ps) { Query.Builder qb = bld.rawQueryBuilder(); qb = qb.branch(); Query.SymmetricExtender extender = qb.symmetricExtender(); hopBuilder.accept(p, extender); qb.done(); } return bld.getting(nextEntityType); }
public Builder with(Query other, Function<Filter, QueryFragment> converter) { with(converter, other.fragments); for (Query sub : other.getSubTrees()) { branch().with(sub, converter).done(); } return this; }
public Builder with(Query other) { with(other.fragments); for (Query sub : other.getSubTrees()) { branch().with(sub).done(); } return this; }