java.lang.Object
org.itsallcode.jdbc.resultset.SimpleResultSet<T>
- Type Parameters:
T- row type
- All Implemented Interfaces:
AutoCloseable,Iterable<T>
-
Constructor Summary
ConstructorsConstructorDescriptionSimpleResultSet(Context context, ResultSet resultSet, ContextRowMapper<T> rowMapper, AutoCloseable statement) Create a new instance. -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
SimpleResultSet
public SimpleResultSet(Context context, ResultSet resultSet, ContextRowMapper<T> rowMapper, AutoCloseable statement) Create a new instance.- Parameters:
context- database contextresultSet- the underlying result setrowMapper- a row mapper for converting each rowstatement- the statement that created the result set. This will be closed when the result set is closed.
-
-
Method Details
-
getMetaData
Get result set metadata.- Returns:
- metadata
-
iterator
Get inIteratorof all rows. -
toList
Collect all rows to a list.- Returns:
- a list with all rows.
-
stream
Get a stream of all rows.- Returns:
- a stream with all rows.
-
close
Close the underlyingResultSetand the statement that created it.- Specified by:
closein interfaceAutoCloseable- Throws:
UncheckedSQLException- if closing fails.
-