me.icymint.libra.jdbc.result.ListResult Maven / Gradle / Ivy
package me.icymint.libra.jdbc.result;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.LinkedList;
import java.util.List;
import me.icymint.libra.jdbc.JdbcAccessException;
/**
* 列表结果。
*
* @author Daniel Yu
* @since 2013-3-14
*
* @param
* 单一结果的Java对象。
*/
public class ListResult extends AbstractResult, T> {
public ListResult(ResultMap rm) {
super(rm);
}
@Override
public List handle(ResultSet rs) {
List list = new LinkedList();
int i = 1;
try {
while (rs.next()) {
list.add(this.handle(rs, i++));
}
} catch (SQLException e) {
throw new JdbcAccessException(e);
}
return list;
}
}