Interface StreamMappable<ELEMENT>

Type Parameters:
ELEMENT - the element type of the stream
All Superinterfaces:
Buildable<Statement<List<ELEMENT>>>, Listable<ELEMENT>, Statement<List<ELEMENT>>
All Known Subinterfaces:
SetOperand<ELEMENT>, SetOperator<ELEMENT>
All Known Implementing Classes:
AbstractSetOperand, NativeSqlSelectIntermediate, NativeSqlSelectStarting, NativeSqlSetStarting, UnifiedSelectStarting

public interface StreamMappable<ELEMENT> extends Listable<ELEMENT>
Represents that the implementation can fetch data from database as a stream and map it to something.
  • Method Details

    • openStream

      Stream<ELEMENT> openStream()
      Open a stream.

      You must close the stream after using it.

      Returns:
      the opened stream
    • mapStream

      <RESULT> RESULT mapStream(Function<Stream<ELEMENT>,RESULT> streamMapper)
      Map a stream.
      Type Parameters:
      RESULT - the mapped result
      Parameters:
      streamMapper - the mapper
      Returns:
      the mapped result
    • collect

      default <RESULT> RESULT collect(Collector<ELEMENT,?,RESULT> collector)
      Collect a stream.
      Type Parameters:
      RESULT - the collected result
      Parameters:
      collector - the collector
      Returns:
      the collected result
    • peek

      StreamMappable<ELEMENT> peek(Consumer<Sql<?>> consumer)
      Description copied from interface: Buildable
      Peeks the built SQL.
      Specified by:
      peek in interface Buildable<ELEMENT>
      Specified by:
      peek in interface Listable<ELEMENT>
      Specified by:
      peek in interface Statement<ELEMENT>
      Parameters:
      consumer - the SQL handler
      Returns:
      this instance