Package org.springframework.jdbc.core.simple

# Interface JdbcClient.MappedQuerySpec<T>

Type Parameters:
  `T` - the RowMapper-declared result type

Enclosing interface:
  JdbcClient

public static interface JdbcClient.MappedQuerySpec<T>
A specification for RowMapper-mapped queries.

## Method Summary

Modifier and Type
Method
Description
`List<T>`
`list()`
Retrieve the result as a pre-resolved list of mapped objects, retaining the order from the original database result.
`default Optional<T>`
`optional()`
Retrieve a single result, if available, as an `Optional` handle.
`default Set<T>`
`set()`
Retrieve the result as an order-preserving set of mapped objects.
`default T`
`single()`
Retrieve a single result as a required object instance.
`Stream<T>`
`stream()`
Retrieve the result as a lazily resolved stream of mapped objects, retaining the order from the original database result.

## Method Details

### stream

Stream<T> stream()
Retrieve the result as a lazily resolved stream of mapped objects, retaining the order from the original database result.

Returns:
  the result Stream, containing mapped objects, needing to be closed once fully processed (for example, through a try-with-resources clause)

### list

List<T> list()
Retrieve the result as a pre-resolved list of mapped objects, retaining the order from the original database result.

Returns:
  the result as a detached List, containing mapped objects

### set

default Set<T> set()
Retrieve the result as an order-preserving set of mapped objects.

Returns:
  the result as a detached Set, containing mapped objects
See Also:
  - `list()`
  - `LinkedHashSet`

### single

default T single()
Retrieve a single result as a required object instance.

Note: As of 6.2, this will enforce non-null result values as originally designed (just accidentally not enforced before).

Returns:
  the single result object (never `null`)
See Also:
  - `optional()`
  - `DataAccessUtils.requiredSingleResult(Collection)`

### optional

default Optional<T> optional()
Retrieve a single result, if available, as an `Optional` handle.

Returns:
  an Optional handle with a single result object or none
See Also:
  - `single()`
  - `DataAccessUtils.optionalResult(Collection)`