Package io.github.pellse.assembler
Interface Assembler<T,RC>
- Type Parameters:
T
- Type for Top Level Entity e.g.Customer
RC
- Output Type e.g.Stream<Transaction>
orFlux<Transaction>
- All Known Implementing Classes:
AssemblerBuilder.AssemblerImpl
public interface Assembler<T,RC>
-
Method Summary
Modifier and TypeMethodDescriptiondefault RC
assembleFromSupplier
(io.github.pellse.util.function.checked.CheckedSupplier<Iterable<T>, Throwable> topLevelEntitiesProvider) static <T,
ID, R, RC>
RCassembleFromSupplier
(io.github.pellse.util.function.checked.CheckedSupplier<Iterable<T>, Throwable> topLevelEntitiesProvider, Function<T, ID> idExtractor, List<io.github.pellse.util.query.Mapper<ID, ?, ?>> subQueryMappers, BiFunction<T, Object[], R> aggregationFunction, AssemblerAdapter<T, ID, R, RC> assemblerAdapter, Function<Throwable, RuntimeException> errorConverter) buildSubQueryMapperSources
(Iterable<T> topLevelEntities, Function<T, ID> idExtractor, List<io.github.pellse.util.query.Mapper<ID, ?, ?>> subQueryMappers, Function<Throwable, RuntimeException> errorConverter)
-
Method Details
-
assemble
-
assembleFromSupplier
-
assembleFromSupplier
static <T,ID, RC assembleFromSupplierR, RC> (io.github.pellse.util.function.checked.CheckedSupplier<Iterable<T>, Throwable> topLevelEntitiesProvider, Function<T, ID> idExtractor, List<io.github.pellse.util.query.Mapper<ID, ?, ?>> subQueryMappers, BiFunction<T, Object[], R> aggregationFunction, AssemblerAdapter<T, ID, R, RC> assemblerAdapter, Function<Throwable, 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::getCustomerId
subQueryMappers
- 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
-