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:
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    accumulate(C container, RowView rowView)
    Accumulate data from the current row into the result container.
    Returns a new, empty result container.
    stream(C container)
    Returns a stream of result elements from the result container.
  • Method Details

    • 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

      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.