Package com.glyart.asql.common.functions
Interface RowMapper<T>
-
- Type Parameters:
T
- The result type
- 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 RowMapper<T>
Represents an interface used to map rows of aResultSet
.Implementations map each row to a generic result 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 can be used for query methods or for other custom implementations.
A RowMapper object is reusable. Also, it's a convenient and fast way for implementing a row-mapping logic in a single spot.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description T
map(ResultSet rs, int rowNumber)
Implementations will tell how to map EACH row of the ResultSet.
ResultSet.next()
call is not needed: this method should only map values of the current row.
-
-
-
Method Detail
-
map
@Nullable T map(@NotNull ResultSet rs, int rowNumber) throws SQLException
Implementations will tell how to map EACH row of the ResultSet.
ResultSet.next()
call is not needed: this method should only map values of the current row.- Parameters:
rs
- the ResultSet, already initializedrowNumber
- the number of the current row- Returns:
- a result object for the current row, or null if the result is not available
- Throws:
SQLException
- if the implementation's trying to get column values in the wrong way
-
-