Package com.glyart.asql.common.functions
Interface ResultSetExtractor<T>
-
- Type Parameters:
T
- the result type
- All Known Implementing Classes:
DefaultExtractor
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface ResultSetExtractor<T>
Represents a callback interface used byDataTemplate
'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 by aSQL DataTemplate and passed to a CompletableFuture for further analysis by the user.This interface is internally used by DataTemplate and, like
RowMapper
, it's reusable. A default implementation called DefaultExtractor is already provided.- See Also:
DefaultExtractor
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description T
extractData(ResultSet rs)
Implementations of this method must provide the processing logic (data extraction) of the entire ResultSet.
-
-
-
Method Detail
-
extractData
@Nullable T extractData(@NotNull ResultSet rs) throws SQLException
Implementations of this method must provide the processing logic (data extraction) of the entire ResultSet.- Parameters:
rs
- the ResultSet to extract data from. Implementations don't need to close this: it will be closed by DataTemplate- Returns:
- an object result or null if it's not available
- Throws:
SQLException
- if an SQLException is encountered while trying to navigate the ResultSet
-
-