public final class ResultSetWrapper extends Object implements AutoCloseable
ResultSet wrapper allowing useful operations like mapping.
If closed, underlying result set will be closed.| Constructor and Description |
|---|
ResultSetWrapper(@NonNull ResultSet set)
Constructs a new wrapper.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the underlying
ResultSet. |
<T> Optional<T> |
map(@NonNull ResultSetMapper<T> mapper)
Maps the first row in the result set, if it exists, using specified mapper and returns an optional value.
|
<T> List<T> |
mapAll(@NonNull ResultSetMapper<T> mapper)
Maps all rows in the result set using specified mapper and collects the results to a list.
|
ResultSet |
set() |
public ResultSetWrapper(@NonNull
@NonNull ResultSet set)
set - A result set.public void close()
throws SQLException
ResultSet.close in interface AutoCloseableSQLException - On SQL error.public <T> List<T> mapAll(@NonNull @NonNull ResultSetMapper<T> mapper) throws SQLException
T - Mapped element type.mapper - Mapper.SQLException - On SQL error.public <T> Optional<T> map(@NonNull @NonNull ResultSetMapper<T> mapper) throws SQLException
T - Mapped element type.mapper - Mapper.SQLException - On SQL error.Copyright © 2021. All rights reserved.