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 used to generate a new Grouper instance for every query against the target table.
  • Method Summary

    Modifier and Type
    Method
    Description
    accumulate(R source)
    Is called for each source row in the group, other than the first one, and then the step method is called.
    begin(R source)
    Is called for the first source row in the group, and then the step method is called.
    default void
    Is called when this Grouper instance is no longer needed.
    default void
    Is called after the last source row in the group has been provided, and then the step method is called.
    step(T target)
    Is called to produce the next target row.
  • Method Details

    • begin

      R begin(R source) throws IOException
      Is called for the first source row in the group, and then the step method is called.
      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
      Is called for each source row in the group, other than the first one, and then the step method is called.
      Parameters:
      source - never null
      Returns:
      the next source row instance to use, or null if it was kept by the grouper
      Throws:
      IOException
    • finished

      default void finished() throws IOException
      Is called after the last source row in the group has been provided, and then the step method is called.
      Throws:
      IOException
    • step

      T step(T target) throws IOException
      Is called to produce the next target row. Returning null indicates that no target rows remain, and that reading of source group rows can resume.
      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