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, wait
Methods 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 inIterator
of 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 underlyingResultSet
and the statement that created it.- Specified by:
close
in interfaceAutoCloseable
- Throws:
UncheckedSQLException
- if closing fails.
-