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.
Defines how to map a
ResultSet to an object.
The given ResultSet is expected to be positioned at the "current" row, i.e. the RowMapper
is not expected to be required to do any cursor placement before doing any value extraction.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfacestatic interfacestatic interfacestatic interfacestatic interfacestatic interfacestatic interfacestatic interfacestatic interface -
Method Summary
Modifier and TypeMethodDescriptiondefault <S> RowMapper<S>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.Obtain the result from the current row of aResultSet.static <R> RowMapper<R>of(ThrowingFunction<ResultSet, R, SQLException> mapper)
-
Method Details
-
of
-
map
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
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
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
-