Package no.digipost.jdbc
Interface BasicColumnMapper<R>
-
- Type Parameters:
R- The type of the result.
- All Superinterfaces:
ColumnMapper<R>
- 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 BasicColumnMapper<R> extends ColumnMapper<R>
The basicColumnMapperretrieves a value from aResultSet, and offers a way to compose a chain offunctionsthat maps the value. As the value retrieved from theResultSetis unconditionally passed down the chain of mapping functions, if retrieving a value from anullablecolumn, consider using aNullableColumnMapperinstead.- See Also:
NullableColumnMapper
-
-
Method Summary
All Methods Static Methods Instance Methods Default Methods Modifier and Type Method Description default <S> BasicColumnMapper<S>andThen(Function<? super R,S> mapper)Create a newBasicColumnMapperwhich will map the result of this one using the givenfunction.default BasicColumnMapper<R>nullFallthrough()Specify that a retrievednullvalue will short circuit any chain from this point.static <R> BasicColumnMapper<R>of(ThrowingBiFunction<String,ResultSet,R,? extends SQLException> function)-
Methods inherited from interface no.digipost.jdbc.ColumnMapper
forColumn, map
-
-
-
-
Method Detail
-
of
static <R> BasicColumnMapper<R> of(ThrowingBiFunction<String,ResultSet,R,? extends SQLException> function)
-
andThen
default <S> BasicColumnMapper<S> andThen(Function<? super R,S> mapper)
Create a newBasicColumnMapperwhich will map the result of this one using the givenfunction.- Type Parameters:
S- The type of object the newColumnMapperyields from aResultSet- Parameters:
mapper- the mapping function- Returns:
- the new mapper
- See Also:
nullFallthrough()
-
nullFallthrough
default BasicColumnMapper<R> nullFallthrough()
Specify that a retrievednullvalue will short circuit any chain from this point. A mapping chain can be constructed withandThen(Function), and if a value retrieved from aResultSetis nullable, usually this should pass unchanged through a chain of mappers asnull. This eliminates the need for the mapping functions to handlenulls.This should be used for rare circumstances where the result from a function passed to
andThen(Function)can benull. If mapping anullabledatabase column, consider using aNullableColumnMapperinstead.- Returns:
- a new
ColumnMapper - See Also:
NullableColumnMapper
-
-