Package org.dalesbred.result
Interface RowMapper<T>
-
- All Known Implementing Classes:
InstantiatorRowMapper
- 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>
Maps a single row of result-set into an object.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default @NotNull ResultSetProcessor<java.util.List<T>>
list()
Creates aResultSetProcessor
that applies this row-mapper to every row and results a list.T
mapRow(@NotNull java.sql.ResultSet resultSet)
Produces a single value based on current row.default @NotNull ResultSetProcessor<java.util.Optional<T>>
optional()
Creates aResultSetProcessor
that no rows or single row from database.default @NotNull ResultSetProcessor<T>
unique()
Creates aResultSetProcessor
that expects a single result row from database.
-
-
-
Method Detail
-
mapRow
T mapRow(@NotNull @NotNull java.sql.ResultSet resultSet) throws java.sql.SQLException
Produces a single value based on current row.The implementation should not call
ResultSet.next()
or other methods to move the current position of theResultSet
, caller is responsible for that.- Throws:
java.sql.SQLException
-
list
@NotNull default @NotNull ResultSetProcessor<java.util.List<T>> list()
Creates aResultSetProcessor
that applies this row-mapper to every row and results a list.
-
unique
@NotNull default @NotNull ResultSetProcessor<T> unique()
Creates aResultSetProcessor
that expects a single result row from database.
-
optional
@NotNull default @NotNull ResultSetProcessor<java.util.Optional<T>> optional()
Creates aResultSetProcessor
that no rows or single row from database.
-
-