/** * 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); }