Interface RowReducer<C,​R>

  • Type Parameters:
    C - mutable result container type
    R - result element type
    All Known Subinterfaces:
    LinkedHashMapRowReducer<K,​V>

    public interface RowReducer<C,​R>
    Reduces row data from a ResultSet into a stream of result elements. Useful for collapsing one-to-many joins.
    See Also:
    ResultBearing.reduceRows(RowReducer)
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void accumulate​(C container, RowView rowView)
      Accumulate data from the current row into the result container.
      C container()
      Returns a new, empty result container.
      java.util.stream.Stream<R> stream​(C container)
      Returns a stream of result elements from the result container.
    • Method Detail

      • container

        C container()
        Returns a new, empty result container.
        Returns:
        a new result container.
      • accumulate

        void accumulate​(C container,
                        RowView rowView)
        Accumulate data from the current row into the result container. Do not attempt to accumulate the RowView itself into the result container--it is only valid within the accumulate() method invocation. Instead, extract mapped types from the RowView by calling RowView.getRow() or RowView.getColumn() and store those values in the container.
        Parameters:
        container - the result container
        rowView - row view over the current result set row.
      • stream

        java.util.stream.Stream<R> stream​(C container)
        Returns a stream of result elements from the result container.
        Parameters:
        container - the result container
        Returns:
        stream of result elements.