Class ReductorConfig.Builder<I,​F,​G,​O>

  • Enclosing class:
    ReductorConfig<I,​F,​G,​O>

    public static class ReductorConfig.Builder<I,​F,​G,​O>
    extends Object
    • Method Detail

      • discriminator

        public ReductorConfig.Builder<I,​F,​G,​O> discriminator​(FailableFunction<I,​F,​PipeException> discriminator)
        Parameters:
        discriminator - The function that identifies which "family" an item belongs to. Items of the same family are being aggregated into the same aggregator object.
        Returns:
        This builder
      • aggregatorCreator

        public ReductorConfig.Builder<I,​F,​G,​O> aggregatorCreator​(Function<F,​G> aggregatorCreator)
        Parameters:
        aggregatorCreator - A generator of a blank new aggregator object of type G. The creator is given the family id in case that it's needed for initialization purposes.
        Returns:
        This builder
      • aggregationLogic

        public ReductorConfig.Builder<I,​F,​G,​O> aggregationLogic​(FailableBiConsumer<G,​I,​PipeException> aggregationLogic)
        Parameters:
        aggregationLogic - Accepts the current aggregator state (of the type denoted by G) and aggregates a given item of type I into it
        Returns:
        This builder
      • postProcessor

        public ReductorConfig.Builder<I,​F,​G,​O> postProcessor​(Function<G,​O> postProcessor)
        Parameters:
        postProcessor - A converter from G to O, to be applied once the aggregation terminates and we are ready to produce an output item
        Returns:
        This builder
      • getDiscriminator

        public FailableFunction<I,​F,​PipeException> getDiscriminator()
        Returns:
        The function that identifies which "family" an item belongs to. Items of the same family are being aggregated into the same aggregator object.
      • getAggregatorCreator

        public Function<F,​G> getAggregatorCreator()
        Returns:
        The generator of a blank new aggregator object of type G. The creator is given the family id in case that it's needed for initialization purposes.
      • getAggregationLogic

        public FailableBiConsumer<G,​I,​PipeException> getAggregationLogic()
        Returns:
        the logic that accepts the current aggregator state (of the type denoted by G) and aggregates a given item of type I into it
      • getPostProcessor

        public Function<G,​O> getPostProcessor()
        Returns:
        The converter from G to O, to be applied once the aggregation terminates and we are ready to produce an output item
      • build

        public ReductorConfig<I,​F,​G,​O> build()
        Returns:
        The new immutable configuration object