Interface Assembler<T,RC>

Type Parameters:
T - Type for Top Level Entity e.g. Customer
RC - Output Type e.g. Stream<Transaction> or Flux<Transaction>
All Known Implementing Classes:
AssemblerBuilder.AssemblerImpl

public interface Assembler<T,RC>
  • Method Details

    • assemble

      default RC assemble(Iterable<T> topLevelEntities)
    • assembleFromSupplier

      RC assembleFromSupplier(io.github.pellse.util.function.checked.CheckedSupplier<Iterable<T>,Throwable> topLevelEntitiesProvider)
    • assembleFromSupplier

      static <T, ID, R, RC> RC assembleFromSupplier(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> or Flux<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 defined RuntimeException
      Returns:
      A list of aggregated objects e.g. Stream<Transaction> or Flux<Transaction> as specified by the assemblerAdapter return type
    • buildSubQueryMapperSources

      static <T, ID> Stream<Supplier<Map<ID,?>>> buildSubQueryMapperSources(Iterable<T> topLevelEntities, Function<T,ID> idExtractor, List<io.github.pellse.util.query.Mapper<ID,?,?>> subQueryMappers, Function<Throwable,RuntimeException> errorConverter)