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.
The basic
ColumnMapper retrieves a value from a ResultSet, and offers a way
to compose a chain of functions that maps the value. As the value retrieved
from the ResultSet is unconditionally passed down the chain of mapping functions, if
retrieving a value from a nullable column, consider using a NullableColumnMapper
instead.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault <S> BasicColumnMapper<S>Create a newBasicColumnMapperwhich will map the result of this one using the givenfunction.default BasicColumnMapper<R>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 Details
-
of
static <R> BasicColumnMapper<R> of(ThrowingBiFunction<String, ResultSet, R, ? extends SQLException> function) -
andThen
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
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:
-