T
- the result type@FunctionalInterface public interface ResultSetExtractor<T>
Database
's query methods.
Implementations of this interface extract results from a ResultSet
and they
don't need to worry about handling exceptions: they will be handled internally by DataOperations
implementations.If the handling is done in async context then implementations should make the details available in some way. AsyncDataOperations
may place these details inside a never null CompletableFuture object.
This interface is internally used by Database and, like ResultSetRowMapper
, it's reusable.
A default implementation called DefaultExtractor is already provided.
DefaultExtractor
Modifier and Type | Method and Description |
---|---|
T |
extractData(@NotNull ResultSet resultSet)
Implementations of this method must provide the processing logic (data extraction) of the entire ResultSet.
|
@Nullable T extractData(@NotNull @NotNull ResultSet resultSet) throws SQLException
resultSet
- the ResultSet to extract data from. Implementations don't need to close this: it will be closed by DatabaseSQLException
- if an SQLException is encountered while trying to navigate the ResultSetCopyright © 2021. All rights reserved.