Package io.github.pellse.assembler
Interface Assembler<T,RC>
-
- Type Parameters:
T- Type for Top Level Entity e.g.CustomerRC- Output Type e.g.Stream<Transaction>orFlux<Transaction>
- All Known Implementing Classes:
AssemblerBuilder.AssemblerImpl
public interface Assembler<T,RC>
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default RCassemble(java.lang.Iterable<T> topLevelEntities)RCassembleFromSupplier(io.github.pellse.util.function.checked.CheckedSupplier<java.lang.Iterable<T>,java.lang.Throwable> topLevelEntitiesProvider)static <T,ID,R,RC>
RCassembleFromSupplier(io.github.pellse.util.function.checked.CheckedSupplier<java.lang.Iterable<T>,java.lang.Throwable> topLevelEntitiesProvider, java.util.function.Function<T,ID> idExtractor, java.util.List<io.github.pellse.util.query.Mapper<ID,?,?>> subQueryMappers, java.util.function.BiFunction<T,java.lang.Object[],R> aggregationFunction, AssemblerAdapter<T,ID,R,RC> assemblerAdapter, java.util.function.Function<java.lang.Throwable,java.lang.RuntimeException> errorConverter)static <T,ID>
java.util.stream.Stream<java.util.function.Supplier<java.util.Map<ID,?>>>buildSubQueryMapperSources(java.lang.Iterable<T> topLevelEntities, java.util.function.Function<T,ID> idExtractor, java.util.List<io.github.pellse.util.query.Mapper<ID,?,?>> subQueryMappers, java.util.function.Function<java.lang.Throwable,java.lang.RuntimeException> errorConverter)
-
-
-
Method Detail
-
assembleFromSupplier
RC assembleFromSupplier(io.github.pellse.util.function.checked.CheckedSupplier<java.lang.Iterable<T>,java.lang.Throwable> topLevelEntitiesProvider)
-
assembleFromSupplier
static <T,ID,R,RC> RC assembleFromSupplier(io.github.pellse.util.function.checked.CheckedSupplier<java.lang.Iterable<T>,java.lang.Throwable> topLevelEntitiesProvider, java.util.function.Function<T,ID> idExtractor, java.util.List<io.github.pellse.util.query.Mapper<ID,?,?>> subQueryMappers, java.util.function.BiFunction<T,java.lang.Object[],R> aggregationFunction, AssemblerAdapter<T,ID,R,RC> assemblerAdapter, java.util.function.Function<java.lang.Throwable,java.lang.RuntimeException> errorConverter)- Type Parameters:
T- e.g.<Customer>ID- e.g.<Long>R- e.g.<Transaction>RC- e.g.Stream<Transaction>orFlux<Transaction>- Parameters:
topLevelEntitiesProvider- e.g.() -> List<Customer>idExtractor- e.g.Customer::getCustomerIdsubQueryMappers- e.g.[ Mapper<Long, BillingInfo>, Mapper<Long, List<OrderItem>> ]aggregationFunction- e.g.buildTransaction(customer, [ billingInfo, orderItemList ])assemblerAdapter- Pluggable execution engine for invoking top and sub queries (e.g. Project Reactor, RxJava)errorConverter- Converts any exception thrown into a user definedRuntimeException- Returns:
- A list of aggregated objects e.g.
Stream<Transaction>orFlux<Transaction>as specified by the assemblerAdapter return type
-
buildSubQueryMapperSources
static <T,ID> java.util.stream.Stream<java.util.function.Supplier<java.util.Map<ID,?>>> buildSubQueryMapperSources(java.lang.Iterable<T> topLevelEntities, java.util.function.Function<T,ID> idExtractor, java.util.List<io.github.pellse.util.query.Mapper<ID,?,?>> subQueryMappers, java.util.function.Function<java.lang.Throwable,java.lang.RuntimeException> errorConverter)
-
-