public class RowMapperResultSetExtractor<T> extends Object implements ResultSetExtractor<List<T>>
ResultSetExtractor interface that delegates to a RowMapper which is
supposed to create an object for each row. Each object is added to the results List of this
ResultSetExtractor.
Useful for the typical case of one object per row in the database table. The number of entries in the results will match the number of rows.
Note that a RowMapper object is typically stateless and thus reusable.
RowMapper,
CqlTemplate| Constructor and Description |
|---|
RowMapperResultSetExtractor(RowMapper<T> rowMapper)
Create a new
RowMapperResultSetExtractor. |
RowMapperResultSetExtractor(RowMapper<T> rowMapper,
int rowsExpected)
Create a new
RowMapperResultSetExtractor. |
| Modifier and Type | Method and Description |
|---|---|
List<T> |
extractData(com.datastax.oss.driver.api.core.cql.ResultSet resultSet)
Implementations must implement this method to process the entire
ResultSet. |
public RowMapperResultSetExtractor(RowMapper<T> rowMapper)
RowMapperResultSetExtractor.rowMapper - the RowMapper which creates an object for each row, must not be null.public RowMapperResultSetExtractor(RowMapper<T> rowMapper, int rowsExpected)
RowMapperResultSetExtractor.rowMapper - the RowMapper which creates an object for each row, must not be null.rowsExpected - the number of expected rows (just used for optimized collection handling).public List<T> extractData(com.datastax.oss.driver.api.core.cql.ResultSet resultSet) throws com.datastax.oss.driver.api.core.DriverException, DataAccessException
ResultSetExtractorResultSet.extractData in interface ResultSetExtractor<List<T>>resultSet - ResultSet to extract data from.com.datastax.oss.driver.api.core.DriverException - if a DriverException is encountered getting column values or navigating (that is,
there's no need to catch DriverException)DataAccessException - in case of custom exceptionsCopyright © 2011–2021 Pivotal Software, Inc.. All rights reserved.