@FunctionalInterface public interface ResultSetExtractor<T>
CqlTemplate
's query methods. Implementations of this interface perform the actual
work of extracting results from a ResultSet
, but don't need to worry about exception handling.
DriverException
s will be caught and handled by the calling CqlTemplate
.
This interface is mainly used within the CQL framework itself. A RowMapper
is usually a simpler choice for
ResultSet
processing, mapping one result object per row instead of one result object for the entire
ResultSet
.
Note: In contrast to a RowCallbackHandler
, a ResultSetExtractor
object is typically stateless and
thus reusable, as long as it doesn't access stateful resources or keep result state within the object.
AsyncCqlTemplate
,
CqlTemplate
,
RowCallbackHandler
,
RowMapper
Modifier and Type | Method and Description |
---|---|
T |
extractData(com.datastax.oss.driver.api.core.cql.ResultSet resultSet)
Implementations must implement this method to process the entire
ResultSet . |
@Nullable T extractData(com.datastax.oss.driver.api.core.cql.ResultSet resultSet) throws com.datastax.oss.driver.api.core.DriverException, DataAccessException
ResultSet
.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.