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

  • Type Parameters:
    I - The data type of the input items
    F - The data type of the family identifier
    G - The intermediate form items get aggregated to. Must be mutable.
    O - The data type of output items

    public class ReductorConfig<I,​F,​G,​O>
    extends Object
    A configuration for a reduction operation. Reduction consists of identifying disjoint "families" of items in the input and aggregating each family separately into some summary output item. Uses builder design pattern.
    Author:
    Eyal Schneider
    • Method Detail

      • builder

        public static <I,​F,​G,​O> ReductorConfig.Builder<I,​F,​G,​O> builder()
        Returns:
        A new builder to use for defining the reductor settings
      • 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