Interface CassandraConverter
- All Superinterfaces:
EntityConverter<CassandraPersistentEntity<?>,,CassandraPersistentProperty, Object, Object> EntityReader<Object,,Object> EntityWriter<Object,Object>
- All Known Implementing Classes:
AbstractCassandraConverter,MappingCassandraConverter
public interface CassandraConverter
extends EntityConverter<CassandraPersistentEntity<?>,CassandraPersistentProperty,Object,Object>
Central Cassandra specific converter interface from Object to Row.
- Author:
- Alex Shvid, Matthew T. Adams, Mark Paluch
-
Method Summary
Modifier and TypeMethodDescriptionconvertToColumnType(Object value) Converts the given object into a value Cassandra will be able to store natively in a column.convertToColumnType(Object value, ColumnType typeDescriptor) Converts the given object into a value Cassandra will be able to store natively in a column.default ObjectconvertToColumnType(Object value, TypeInformation<?> typeInformation) Converts the given object into a value Cassandra will be able to store natively in a column.com.datastax.oss.driver.api.core.type.codec.registry.CodecRegistryReturns theCodecRegistryregistered in theCassandraConverter.Returns theCustomConversionsfor this converter.getId(Object object, CassandraPersistentEntity<?> entity) Returns the Id for an entity.Returns theProjectionFactoryfor this converter.<R> Rproject(EntityProjection<R, ?> descriptor, com.datastax.oss.driver.api.core.cql.Row row) Apply a projection toRowand return the projection return typeR.voidwrite(Object source, Object sink, CassandraPersistentEntity<?> entity) Methods inherited from interface org.springframework.data.convert.EntityConverter
getConversionServiceMethods inherited from interface org.springframework.data.convert.EntityReader
readMethods inherited from interface org.springframework.data.convert.EntityWriter
write
-
Method Details
-
getProjectionFactory
ProjectionFactory getProjectionFactory()Returns theProjectionFactoryfor this converter.- Returns:
- will never be null.
- Since:
- 3.4
-
getCustomConversions
CustomConversions getCustomConversions()Returns theCustomConversionsfor this converter.- Returns:
- will never be null.
-
getCodecRegistry
com.datastax.oss.driver.api.core.type.codec.registry.CodecRegistry getCodecRegistry()Returns theCodecRegistryregistered in theCassandraConverter.- Returns:
- the
CodecRegistry. - Since:
- 3.0
-
getMappingContext
CassandraMappingContext getMappingContext()- Specified by:
getMappingContextin interfaceEntityConverter<CassandraPersistentEntity<?>,CassandraPersistentProperty, Object, Object>
-
getColumnTypeResolver
ColumnTypeResolver getColumnTypeResolver()- Returns:
- the
ColumnTypeResolver - Since:
- 3.0
-
project
Apply a projection toRowand return the projection return typeR.Non-projectingdescriptors fall back toregular object materialization.- Type Parameters:
R-- Parameters:
descriptor- the projection descriptor, must not be null.row- must not be null.- Returns:
- a new instance of the projection return type
R. - Since:
- 3.4
-
getId
Returns the Id for an entity. It can return:- A singular value if for a simple
IdorPrimaryKeyId - A
MapIdfor compositePrimaryKeyColumnId's - A the composite primary key for
PrimaryKeyusing aPrimaryKeyClass
- Parameters:
object- must not be null.entity- must not be null.- Returns:
- the id value or null, if the id is not set.
- A singular value if for a simple
-
convertToColumnType
Converts the given object into a value Cassandra will be able to store natively in a column.- Parameters:
value-Objectto convert; must not be null.- Returns:
- the result of the conversion.
- Since:
- 2.0
-
convertToColumnType
Converts the given object into a value Cassandra will be able to store natively in a column.- Parameters:
value-Objectto convert; must not be null.typeInformation-TypeInformationused to describe the object type; must not be null.- Returns:
- the result of the conversion.
- Since:
- 1.5
-
convertToColumnType
Converts the given object into a value Cassandra will be able to store natively in a column.- Parameters:
value-Objectto convert; must not be null.typeDescriptor-ColumnTypeused to describe the object type; must not be null.- Returns:
- the result of the conversion.
- Since:
- 3.0
-
write
- Parameters:
source- the source, must not be null.sink- must not be null.entity- must not be null.
-