Package org.jdbi.v3.core.result
Interface ResultBearing
- All Known Implementing Classes:
 BatchResultBearing,MetaData,PreparedBatch,Query
public interface ResultBearing
Provides access to the contents of a 
ResultSet by mapping to Java types.- 
Method Summary
Modifier and TypeMethodDescriptiondefault <R> RcollectInto(Class<R> containerType) Collect the results into a container of the given type.default ObjectcollectInto(Type containerType) Collect the results into a container of the given type.default <R> RcollectInto(GenericType<R> containerType) Collect the results into a container of the given generic type.default <A,R> R collectRows(Collector<RowView, A, R> collector) Collect the results using the given collector.default <T> ResultIterable<T>map(ColumnMapper<T> mapper) Maps this result set to aResultIterable, using the given column mapper.default <T> ResultIterable<T>Maps this result set to aResultIterable, using the given row mapper.default <T> ResultIterable<T>map(RowViewMapper<T> mapper) Maps this result set to aResultIterable, using the givenRowViewMapper.default <T> ResultIterable<T>Maps this result set to aResultIterableof the given element type.default ResultIterable<?>Maps this result set to aResultIterableof the given element type.default <T> ResultIterable<T>mapTo(GenericType<T> type) Maps this result set to aResultIterableof the given element type.default <T> ResultIterable<T>mapTo(QualifiedType<T> type) Maps this result set to aResultIterableof the given qualified element type.default <T> ResultIterable<T>Maps this result set to aResultIterableof the given element type, usingBeanMapper.default ResultIterable<Map<String,Object>> mapToMap()Maps this result set to aResultIterableofMap<String,Object>.default <T> ResultIterable<Map<String,T>> default <T> ResultIterable<Map<String,T>> mapToMap(GenericType<T> valueType) static ResultBearingof(Supplier<ResultSet> resultSetSupplier, StatementContext ctx) Returns a ResultBearing backed by the given result set supplier and context.default <U> UreduceResultSet(U seed, ResultSetAccumulator<U> accumulator) Reduce the results.default <K,V> Stream<V> reduceRows(BiConsumer<Map<K, V>, RowView> accumulator) Reduce the result rows using aMap<K, V>as the result container.default <C,R> Stream<R> reduceRows(RowReducer<C, R> rowReducer) Reduce the result rows using the given row reducer.default <U> UreduceRows(U seed, BiFunction<U, RowView, U> accumulator) Reduce the results.<R> RscanResultSet(ResultSetScanner<R> resultSetScanner) Invokes the mapper with a result set supplier, and returns the value returned by the mapper. 
- 
Method Details
- 
of
Returns a ResultBearing backed by the given result set supplier and context.- Parameters:
 resultSetSupplier- result set supplierctx- the statement context- Returns:
 - a ResultBearing
 
 - 
scanResultSet
Invokes the mapper with a result set supplier, and returns the value returned by the mapper.- Type Parameters:
 R- result type returned by the mapper.- Parameters:
 resultSetScanner- result set scanner- Returns:
 - the value returned by the mapper.
 
 - 
mapTo
Maps this result set to aResultIterableof the given element type.- Type Parameters:
 T- the type to map the result set rows to- Parameters:
 type- the type to map the result set rows to- Returns:
 - a 
ResultIterableof the given type. - See Also:
 
 - 
mapTo
Maps this result set to aResultIterableof the given element type.- Type Parameters:
 T- the type to map the result set rows to- Parameters:
 type- the type to map the result set rows to- Returns:
 - a 
ResultIterableof the given type. - See Also:
 
 - 
mapTo
Maps this result set to aResultIterableof the given element type.- Parameters:
 type- the type to map the result set rows to- Returns:
 - a 
ResultIterableof the given type. - See Also:
 
 - 
mapTo
Maps this result set to aResultIterableof the given qualified element type.- Parameters:
 type- the qualified type to map the result set rows to- Returns:
 - a 
ResultIterableof the given type. - See Also:
 
 - 
mapToBean
Maps this result set to aResultIterableof the given element type, usingBeanMapper.- Type Parameters:
 T- the bean type to map the result set rows to- Parameters:
 type- the bean type to map the result set rows to- Returns:
 - a 
ResultIterableof the given type. 
 - 
mapToMap
Maps this result set to aResultIterableofMap<String,Object>. Keys are column names, and values are column values.- Returns:
 - a 
ResultIterable<Map<String,Object>>. 
 - 
mapToMap
- Type Parameters:
 T- the value type- Parameters:
 valueType- the class to map the resultset columns to- Returns:
 - a 
Mapof String and the given type. - See Also:
 
 - 
mapToMap
- Type Parameters:
 T- the value type- Parameters:
 valueType- the type to map the resultset columns to- Returns:
 - a 
Mapof String and the given type. - See Also:
 
 - 
map
Maps this result set to aResultIterable, using the given column mapper.- Type Parameters:
 T- the type to map the result set rows to- Parameters:
 mapper- column mapper used to map the first column of each row- Returns:
 - a 
ResultIterableof type<T>. 
 - 
map
Maps this result set to aResultIterable, using the given row mapper.- Type Parameters:
 T- the type to map the result set rows to- Parameters:
 mapper- mapper used to map each row- Returns:
 - a 
ResultIterableof type<T>. 
 - 
map
Maps this result set to aResultIterable, using the givenRowViewMapper. This overload only exists to allow RowViewMapper as the type of a lambda expression.- Type Parameters:
 T- the type to map the result set rows to- Parameters:
 mapper- RowViewMapper used to map each row- Returns:
 - a 
ResultIterableof type<T>. 
 - 
reduceRows
Reduce the result rows using the given row reducer.- Type Parameters:
 C- Mutable result container typeR- Result element type- Parameters:
 rowReducer- the row reducer.- Returns:
 - the stream of result elements
 - See Also:
 
 - 
reduceRows
Reduce the result rows using aMap<K, V>as the result container.- Type Parameters:
 K- map key typeV- map value type- Parameters:
 accumulator- accumulator function which gathers data from eachRowViewinto the result map.- Returns:
 - the stream of elements in the container's 
Map.values()collection, in the order they were inserted. 
 - 
reduceRows
Reduce the results. Using aBiFunction<U, RowView, U>, repeatedly combine query results until only a single value remains.- Type Parameters:
 U- the type of the accumulator- Parameters:
 seed- theUto combine with the first resultaccumulator- the function to apply repeatedly- Returns:
 - the final 
U 
 - 
reduceResultSet
Reduce the results. Using aResultSetAccumulator, repeatedly combine query results until only a single value remains.- Type Parameters:
 U- the accumulator type- Parameters:
 seed- theUto combine with the first resultaccumulator- the function to apply repeatedly- Returns:
 - the final 
U 
 - 
collectRows
Collect the results using the given collector. Do not attempt to accumulate theRowViewobjects into the result--they are only valid within theCollector.accumulator()function. Instead, extract mapped types from the RowView by callingRowView.getRow()orRowView.getColumn().- Type Parameters:
 A- the mutable accumulator type used by the collector.R- the result type returned by the collector.- Parameters:
 collector- the collector to collect the result rows.- Returns:
 - the result of the collection
 
 - 
collectInto
Collect the results into a container of the given type. A collector must be registered for the container type, which knows the element type for the container. A mapper must be registered for the element type.This method is equivalent to
ResultBearing.mapTo(elementType).collect(containerCollector).- Type Parameters:
 R- the result container type- Parameters:
 containerType- the container type into which results will be collected- Returns:
 - a container into which result rows have been collected
 
 - 
collectInto
Collect the results into a container of the given generic type. A collector must be registered for the container type, which knows the element type for the container. A mapper must be registered for the element type.This method is equivalent to
ResultBearing.mapTo(elementType).collect(containerCollector).Example:
Map<Long, User> usersById = handle.createQuery("select * from user") .configure(MapEntryMappers.class, cfg -> cfg.setKeyColumn("id")) .collectInto(new GenericType<Map<Long, User>>() {});- Type Parameters:
 R- the result container type- Parameters:
 containerType- the container type into which results will be collected- Returns:
 - a container into which result rows have been collected
 
 - 
collectInto
Collect the results into a container of the given type. A collector must be registered for the container type, which knows the element type for the container. A mapper must be registered for the element type.This method is equivalent to
ResultBearing.mapTo(elementType).collect(containerCollector).- Parameters:
 containerType- the container type into which results will be collected- Returns:
 - a container into which result rows have been collected
 
 
 -