T
- the target type the input ResultSet
will be converted to.@FunctionalInterface public interface ResultSetHandler<T>
ResultSet
s to other objects.Modifier and Type | Field and Description |
---|---|
static ResultSetHandler<Void> |
VOID
Returns nothing.
|
Modifier and Type | Method and Description |
---|---|
T |
handle(ResultSet rs)
Turn the
ResultSet into an instance of T. |
static <T> ResultSetHandler<List<T>> |
list(RowProcessor<T> rowProcessor) |
static <K,V> ResultSetHandler<Map<K,V>> |
map(String keyColumn,
Class<K> keyClass,
RowProcessor<V> rowProcessor) |
static <T> ResultSetHandler<Optional<T>> |
optional(ResultSetHandler<T> resultSetHandler) |
static <T> ResultSetHandler<T> |
single(RowProcessor<T> rowProcessor) |
static final ResultSetHandler<Void> VOID
static <T> ResultSetHandler<T> single(RowProcessor<T> rowProcessor)
static <T> ResultSetHandler<Optional<T>> optional(ResultSetHandler<T> resultSetHandler)
T
- the type of the instance wrapped in an Optional
resultSetHandler
- processes the ResultSet
ResultSetHandler
, wrapped in an Optional
.static <T> ResultSetHandler<List<T>> list(RowProcessor<T> rowProcessor)
static <K,V> ResultSetHandler<Map<K,V>> map(String keyColumn, Class<K> keyClass, RowProcessor<V> rowProcessor)
K
- the type of the Map
keysV
- the type of the Map
valueskeyColumn
- the name of the column the map key can be extracted fromkeyClass
- the type of the Map
keysrowProcessor
- creates an instance of VMap
with keys taken from keyColumn or an empty Map
if the ResultSet
is empty.MapResultSetHandler
Copyright © 2014. All rights reserved.