Class AbstractResultSetConverter<T>
java.lang.Object
org.springframework.data.cassandra.core.cql.converter.AbstractResultSetConverter<T>
- Type Parameters:
T-
- All Implemented Interfaces:
Converter<com.datastax.oss.driver.api.core.cql.ResultSet,T>
- Direct Known Subclasses:
AbstractResultSetToBasicFixedTypeConverter,ResultSetToByteBufferConverter,ResultSetToListOfStringConverter,ResultSetToStringConverter
public abstract class AbstractResultSetConverter<T>
extends Object
implements Converter<com.datastax.oss.driver.api.core.cql.ResultSet,T>
Convenient converter that can be used to convert a single-row-single-column, single-row-multi-column, or multi-row
ResultSet into the given value of a given type. The majority of the expected usage is to convert a
single-row-single-column result set into the target type.
The algorithm is:
- if there is one row with one column, convert that value to this converter's type if possible or throw,
- else if there is one row with multiple columns, convert the columns into this converter's type if possible or throw,
- else convert the rows into this converter's type (since there are multiple rows) or throw.
If the converter throws due to the inability to convert a given ResultSet, it will throw an
IllegalArgumentException.
- Author:
- Matthew T. Adams, Mark Paluch
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionconvert(com.datastax.oss.driver.api.core.cql.ResultSet source) protected TdoConvertResultSet(List<Map<String, Object>> resultSet) Converts the given result set (as aList<Map<String,Object>>) to this converter's type or throwsIllegalArgumentException.protected TdoConvertSingleRow(Map<String, Object> row) Converts the given row (as aMap<String,Object>) to this converter's type or throwsIllegalArgumentException.protected abstract TdoConvertSingleValue(Object object) Converts the given value to this converter's type or throwsIllegalArgumentException.protected Tprotected Tprotected abstract Class<?>getType()
-
Constructor Details
-
AbstractResultSetConverter
public AbstractResultSetConverter()
-
-
Method Details
-
doConvertSingleValue
Converts the given value to this converter's type or throwsIllegalArgumentException. -
getType
- Returns:
- the target type.
-
getNullResultSetValue
- Returns:
- surrogate value if the
ResultSetis null.
-
getExhaustedResultSetValue
- Returns:
- surrogate value if the
ResultSetisPagingIterable.isFullyFetched()}.
-
convert
-
doConvertResultSet
Converts the given result set (as aList<Map<String,Object>>) to this converter's type or throwsIllegalArgumentException. This default implementation simply throws. -
doConvertSingleRow
Converts the given row (as aMap<String,Object>) to this converter's type or throwsIllegalArgumentException. This default implementation simply throws.
-