Interface ProjectionAccumulator<F,​V,​U,​R>

    • Method Detail

      • createInitial

        U createInitial()
        Creates the initial accumulated container.

        This operation should be non-blocking.

        Returns:
        The initial accumulated container, to pass to the first call to accumulate(Object, Object).
      • accumulate

        U accumulate​(U accumulated,
                     F value)
        Folds a new value in the given accumulated container.

        This operation should be non-blocking.

        Parameters:
        accumulated - The accumulated value so far. For the first call, this is a value returned by createInitial(). For the next calls, this is the value returned by the previous call to accumulate(Object, Object).
        value - The value to accumulate.
        Returns:
        The new accumulated value.
      • finish

        R finish​(U accumulated,
                 ProjectionConverter<? super F,​? extends V> converter,
                 FromDocumentFieldValueConvertContext context)
        Finishes the collecting, converting the accumulated container into the final result.

        This operation may be blocking.

        Parameters:
        accumulated - The temporary storage created by createInitial() and populated by successive calls to accumulate(Object, Object).
        converter - The projection converter (from F to V).
        context - The context to be passed to the projection converter.
        Returns:
        The final result of the collecting.