Package no.digipost.jdbc
Interface RowMapper<R>
-
- Type Parameters:
R- The type of object thisRowMapperyields from aResultSet
- All Known Subinterfaces:
RowMapper.Decupled<T,U,V,W,X,Z,A,B,C,D>,RowMapper.Hextupled<T,U,V,W,X,Z>,RowMapper.Nonupled<T,U,V,W,X,Z,A,B,C>,RowMapper.Octupled<T,U,V,W,X,Z,A,B>,RowMapper.Pentupled<T,U,V,W,X>,RowMapper.Quadrupled<T,U,V,W>,RowMapper.Septupled<T,U,V,W,X,Z,A>,RowMapper.Tripled<T,U,V>,RowMapper.Tupled<T,U>
- All Known Implementing Classes:
AttributeMapper,AttributesRowMapper
- 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<R>
Defines how to map aResultSetto an object. The givenResultSetis expected to be positioned at the "current" row, i.e. theRowMapperis not expected to be required to do any cursor placement before doing any value extraction.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceRowMapper.Decupled<T,U,V,W,X,Z,A,B,C,D>static interfaceRowMapper.Hextupled<T,U,V,W,X,Z>static interfaceRowMapper.Nonupled<T,U,V,W,X,Z,A,B,C>static interfaceRowMapper.Octupled<T,U,V,W,X,Z,A,B>static interfaceRowMapper.Pentupled<T,U,V,W,X>static interfaceRowMapper.Quadrupled<T,U,V,W>static interfaceRowMapper.Septupled<T,U,V,W,X,Z,A>static interfaceRowMapper.Tripled<T,U,V>static interfaceRowMapper.Tupled<T,U>
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default <S> RowMapper<S>andThen(Function<? super R,S> resultMapper)Create a new mapper which takes the result of this mapper and applies the givenFunctionto yield another result.default <S> RowMapper.Tupled<R,S>combinedWith(RowMapper<S> otherMapper)Create a new row mapper which first runs this mapper and then the given mapper, and combines the two results into a tuple-type container.Rmap(ResultSet resultSet)Obtain the result from the current row of aResultSet.static <R> RowMapper<R>of(ThrowingFunction<ResultSet,R,SQLException> mapper)
-
-
-
Method Detail
-
of
static <R> RowMapper<R> of(ThrowingFunction<ResultSet,R,SQLException> mapper)
-
map
R map(ResultSet resultSet) throws SQLException
Obtain the result from the current row of aResultSet.- Parameters:
resultSet- theResultSet- Returns:
- the result
- Throws:
SQLException- if any error happens when processing theResultSet. May be if the name/label is not valid, if a database access error occurs, or this method is called on a closed result set.
-
andThen
default <S> RowMapper<S> andThen(Function<? super R,S> resultMapper)
Create a new mapper which takes the result of this mapper and applies the givenFunctionto yield another result.- Type Parameters:
S- the output type of the givenresultMapperfunction, which also become the type of the result produced by the new row mapper.- Parameters:
resultMapper- the function to apply to the result- Returns:
- the new row mapper
-
combinedWith
default <S> RowMapper.Tupled<R,S> combinedWith(RowMapper<S> otherMapper)
Create a new row mapper which first runs this mapper and then the given mapper, and combines the two results into a tuple-type container.- Parameters:
otherMapper- the mapper to run in addition to this.- Returns:
- the new mapper
-
-