Package com.valqueries
Class ResultSetIterator<T>
java.lang.Object
com.valqueries.ResultSetIterator<T>
- All Implemented Interfaces:
AutoCloseable
,Iterator<T>
Used to create a Stream out of ResultSet and close it after the Stream is consumed.
-
Constructor Summary
ConstructorsConstructorDescriptionResultSetIterator
(Connection connection, OrmStatement statement, IRowMapper<T> rowMapper, boolean autoClose) -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Iterator
forEachRemaining, remove
-
Constructor Details
-
ResultSetIterator
public ResultSetIterator(Connection connection, OrmStatement statement, IRowMapper<T> rowMapper, boolean autoClose)
-
-
Method Details
-
hasNext
public boolean hasNext() -
next
-
close
public void close()Closes the resultSet, preparedStatement, and possibly the connection, if it was provided in the constructor. The objects are closed in this order. If any exception is encountered it thrown after all objects were closed. Any subsequent exceptions are added as suppressed exceptions to the first one.- Specified by:
close
in interfaceAutoCloseable
-