Package org.jdbi.v3.core.result.internal
Class ResultSetResultIterable<T>
- java.lang.Object
-
- org.jdbi.v3.core.result.internal.ResultSetResultIterable<T>
-
- All Implemented Interfaces:
java.lang.Iterable<T>,ResultIterable<T>
public class ResultSetResultIterable<T> extends java.lang.Object implements ResultIterable<T>
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.jdbi.v3.core.result.ResultIterable
ResultIterable.ResultIteratorDelegate<T,R>
-
-
Field Summary
Fields Modifier and Type Field Description private StatementContextctxprivate RowMapper<T>mapperprivate java.util.function.Supplier<java.sql.ResultSet>resultSetSupplier
-
Constructor Summary
Constructors Constructor Description ResultSetResultIterable(RowMapper<T> mapper, StatementContext ctx, java.util.function.Supplier<java.sql.ResultSet> resultSetSupplier)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <R extends java.util.Collection<? super T>>
RcollectInto(java.lang.reflect.Type containerType)Collect the results into a container type.java.util.List<T>collectIntoList()Returns results in aList.java.util.Set<T>collectIntoSet()Returns results in aSet.ResultIterator<T>iterator()Stream all the rows of the result set out with anIterator.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jdbi.v3.core.result.ResultIterable
collect, collectInto, collectToMap, filter, findFirst, findOne, findOnly, first, forEach, forEachWithCount, list, map, one, reduce, set, stream, toCollection, useIterator, useStream, withIterator, withStream
-
-
-
-
Field Detail
-
ctx
private final StatementContext ctx
-
resultSetSupplier
private final java.util.function.Supplier<java.sql.ResultSet> resultSetSupplier
-
-
Constructor Detail
-
ResultSetResultIterable
public ResultSetResultIterable(RowMapper<T> mapper, StatementContext ctx, java.util.function.Supplier<java.sql.ResultSet> resultSetSupplier)
-
-
Method Detail
-
iterator
public ResultIterator<T> iterator()
Description copied from interface:ResultIterableStream all the rows of the result set out with anIterator. TheIteratormust be closed to release database resources.- Specified by:
iteratorin interfacejava.lang.Iterable<T>- Specified by:
iteratorin interfaceResultIterable<T>- Returns:
- the results as a streaming Iterator
-
collectInto
public <R extends java.util.Collection<? super T>> R collectInto(java.lang.reflect.Type containerType)
Description copied from interface:ResultIterableCollect the results into a container type.- Specified by:
collectIntoin interfaceResultIterable<T>- Parameters:
containerType- ATypeobject that must describe a container type- Returns:
- A new collection implementing the container type with all results inserted
-
collectIntoList
public java.util.List<T> collectIntoList()
Description copied from interface:ResultIterableReturns results in aList. The implementation of the list can be changed by registering aCollector:
orjdbi.getConfig(JdbiCollectors.class).registerCollector(List.class, Collectors.toCollection(LinkedList::new));handle.registerCollector(List.class, Collectors.toCollection(LinkedList::new));
If no collector is registered, then this method behaves likeResultIterable.list().- Specified by:
collectIntoListin interfaceResultIterable<T>- Returns:
- results in a
List - See Also:
ResultIterable.list(),ResultIterable.toCollection(Supplier)
-
collectIntoSet
public java.util.Set<T> collectIntoSet()
Description copied from interface:ResultIterableReturns results in aSet. The implementation of the set can be changed by registering aCollector:
orjdbi.getConfig(JdbiCollectors.class).registerCollector(Set.class, Collectors.toCollection(LinkedHashSet::new));handle.registerCollector(Set.class, Collectors.toCollection(LinkedHashSet::new));
If no collector is registered, then this method behaves likeResultIterable.set().- Specified by:
collectIntoSetin interfaceResultIterable<T>- Returns:
- results in a
Set - See Also:
ResultIterable.set(),ResultIterable.toCollection(Supplier)
-
-