Package org.jdbi.v3.core.result
Interface ResultBearing
- All Known Implementing Classes:
- MetaData,- PreparedBatch,- Query
public interface ResultBearing
Provides access to the contents of a 
ResultSet by mapping to Java types.- 
Method SummaryModifier 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> reducer) 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> mapper) Invokes the mapper with a result set supplier, and returns the value returned by the mapper.
- 
Method Details- 
ofReturns a ResultBearing backed by the given result set supplier and context.- Parameters:
- resultSetSupplier- result set supplier
- ctx- the statement context
- Returns:
- a ResultBearing
 
- 
scanResultSetInvokes 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:
- mapper- result set scanner
- Returns:
- the value returned by the mapper.
 
- 
mapToMaps 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:
 
- 
mapToMaps 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:
 
- 
mapToMaps 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:
 
- 
mapToMaps 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:
 
- 
mapToBeanMaps 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.
 
- 
mapToMapMaps 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:
 
- 
mapMaps 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>.
 
- 
mapMaps 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>.
 
- 
mapMaps 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>.
 
- 
reduceRowsReduce the result rows using the given row reducer.- Type Parameters:
- C- Mutable result container type
- R- Result element type
- Parameters:
- reducer- the row reducer.
- Returns:
- the stream of result elements
- See Also:
 
- 
reduceRowsReduce the result rows using aMap<K, V>as the result container.- Type Parameters:
- K- map key type
- V- map value type
- Parameters:
- accumulator- accumulator function which gathers data from each- RowViewinto the result map.
- Returns:
- the stream of elements in the container's Map.values()collection, in the order they were inserted.
 
- 
reduceRowsReduce 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- the- Uto combine with the first result
- accumulator- the function to apply repeatedly
- Returns:
- the final U
 
- 
reduceResultSetReduce the results. Using aResultSetAccumulator, repeatedly combine query results until only a single value remains.- Type Parameters:
- U- the accumulator type
- Parameters:
- seed- the- Uto combine with the first result
- accumulator- the function to apply repeatedly
- Returns:
- the final U
 
- 
collectRowsCollect 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
 
- 
collectIntoCollect 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
 
- 
collectIntoCollect 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
 
- 
collectIntoCollect 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
 
 
-