Package com.jcabi.jdbc
Class ListOutcome<T>
- java.lang.Object
-
- com.jcabi.jdbc.ListOutcome<T>
-
- Type Parameters:
T- Type of items
public final class ListOutcome<T> extends Object implements Outcome<List<T>>
Outcome that returns a list.Use it when you need a full collection:
Collection&lgt;User> users = new JdbcSession(source) .sql("SELECT * FROM user") .select( new ListOutcome<User>( new ListOutcome.Mapping<User>() { @Override public User map(final ResultSet rset) throws SQLException { return new User.Simple(rset.getLong(1), rset.getString(2)); } } ) );- Since:
- 0.13
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.jcabi.jdbc.Outcome
Outcome.Mapping<T>, Outcome.Mappings
-
-
Field Summary
-
Fields inherited from interface com.jcabi.jdbc.Outcome
DEFAULT_MAPPINGS, LAST_INSERT_ID, NOT_EMPTY, UPDATE_COUNT, VOID
-
-
Constructor Summary
Constructors Constructor Description ListOutcome(Outcome.Mapping<T> mpg)Public ctor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<T>handle(ResultSet rset, Statement stmt)Process the result set and return some value.
-
-
-
Constructor Detail
-
ListOutcome
public ListOutcome(Outcome.Mapping<T> mpg)
Public ctor.- Parameters:
mpg- Mapping
-
-
Method Detail
-
handle
public List<T> handle(ResultSet rset, Statement stmt) throws SQLException
Description copied from interface:OutcomeProcess the result set and return some value.- Specified by:
handlein interfaceOutcome<T>- Parameters:
rset- The result set to processstmt- The statement used in the run- Returns:
- The result
- Throws:
SQLException- If something goes wrong inside
-
-