Interface Grouper<R,T>

All Superinterfaces:
AutoCloseable, Closeable

public interface Grouper<R,T> extends Closeable
Interface which processes groups of rows into other groups of rows.
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
    Is called to generate a new Grouper instance for every query against the target table.
  • Method Summary

    Modifier and Type
    Method
    Description
    accumulate(R source)
    Called for each source row in the group, other than the first one.
    begin(R source)
    Called for the first source row in the group.
    default void
    Is called when this Grouper instance is no longer needed.
    process(T target)
    Is called when all source group rows have been provided, and the first row for the target group should be assigned.
    step(T target)
    Is called to produce the next target group row.
  • Method Details

    • begin

      R begin(R source) throws IOException
      Called for the first source row in the group.
      Parameters:
      source - never null
      Returns:
      the next source row instance to use, or null if it was kept by the grouper
      Throws:
      IOException
    • accumulate

      R accumulate(R source) throws IOException
      Called for each source row in the group, other than the first one.
      Parameters:
      source - never null
      Returns:
      the next source row instance to use, or null if it was kept by the grouper
      Throws:
      IOException
    • process

      T process(T target) throws IOException
      Is called when all source group rows have been provided, and the first row for the target group should be assigned. Returning null signals that the target group is empty, and the next source group can begin.
      Parameters:
      target - never null; all columns are initially unset
      Returns:
      null if target group is empty
      Throws:
      IOException
    • step

      T step(T target) throws IOException
      Is called to produce the next target group row. Returning null signals that no target rows remain, and the next source group can begin.
      Parameters:
      target - never null; all columns are initially unset
      Returns:
      null if no target rows remain
      Throws:
      IOException
    • close

      default void close() throws IOException
      Is called when this Grouper instance is no longer needed.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException