Package org.soulwing.jdbc
Interface ResultSetHandler<T>
-
- Type Parameters:
T
- the type of result returned by the handler
public interface ResultSetHandler<T>
A closure that handles the result set returned by a query.This interface provides the means for an
JdbcQuery
query to process the results of a query in an arbitrary fashion.While the
handleResult(ResultSet)
method can return a value, it is not always necessary. When an implementation does not need to return a value, simply useVoid
as the type parameter.Example:
ResultSetHandler<Void> handler = new ResultSetHandler<>() { public Void handleResult(ResultSet rs) throws SQLException { while (rs.next()) { exporter.exportPerson(rs.getLong("id"), rs.getString("name")); } return null; } };
- Author:
- Carl Harris
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description T
handleResult(ResultSet rs)
Handles the result set returned by a query.
-
-
-
Method Detail
-
handleResult
T handleResult(ResultSet rs) throws SQLException
Handles the result set returned by a query.- Parameters:
rs
- the result set to process- Returns:
- any value of type
T
- Throws:
SQLException
- as needed
-
-