Class StreamingResultSetHandler<T>

  • Type Parameters:
    T - the target Stream generic type
    All Implemented Interfaces:
    org.apache.commons.dbutils.ResultSetHandler<Stream<T>>
    Direct Known Subclasses:
    ArrayStreamingHandler, BeanStreamingHandler, MapStreamingHandler

    public abstract class StreamingResultSetHandler<T>
    extends Object
    implements org.apache.commons.dbutils.ResultSetHandler<Stream<T>>
    Abstract class that simplifies the development of ResultSetHandler classes that convert ResultSets into Streams.
    See Also:
    ResultSetHandler
    • Constructor Detail

      • StreamingResultSetHandler

        public StreamingResultSetHandler()
    • Method Detail

      • handle

        public Stream<T> handle​(ResultSet resultSet)
                         throws SQLException
        Whole ResultSet handler. It produces a Stream as the result. To convert individual rows into Java objects it uses the handleRow(ResultSet) method.
        Specified by:
        handle in interface org.apache.commons.dbutils.ResultSetHandler<T>
        Parameters:
        resultSet - The ResultSet to process.
        Returns:
        a Stream of all rows in the result set, each row converted to T
        Throws:
        SQLException - error occurs
        See Also:
        handleRow(ResultSet)
      • handleRow

        protected abstract T handleRow​(ResultSet rs)
                                throws SQLException
        Row handler. Method converts current row into some Java object.
        Parameters:
        rs - ResultSet to process.
        Returns:
        row processing result
        Throws:
        SQLException - error occurs