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 Object
convertToColumnType
(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.CodecRegistry
Returns theCodecRegistry
registered in theCassandraConverter
.Returns theCustomConversions
for this converter.getId
(Object object, CassandraPersistentEntity<?> entity) Returns the Id for an entity.Returns theProjectionFactory
for this converter.<R> R
project
(EntityProjection<R, ?> descriptor, com.datastax.oss.driver.api.core.cql.Row row) Apply a projection toRow
and return the projection return typeR
.void
write
(Object source, Object sink, CassandraPersistentEntity<?> entity) Methods inherited from interface org.springframework.data.convert.EntityConverter
getConversionService
Methods inherited from interface org.springframework.data.convert.EntityReader
read
Methods inherited from interface org.springframework.data.convert.EntityWriter
write
-
Method Details
-
getProjectionFactory
ProjectionFactory getProjectionFactory()Returns theProjectionFactory
for this converter.- Returns:
- will never be null.
- Since:
- 3.4
-
getCustomConversions
CustomConversions getCustomConversions()Returns theCustomConversions
for this converter.- Returns:
- will never be null.
-
getCodecRegistry
com.datastax.oss.driver.api.core.type.codec.registry.CodecRegistry getCodecRegistry()Returns theCodecRegistry
registered in theCassandraConverter
.- Returns:
- the
CodecRegistry
. - Since:
- 3.0
-
getMappingContext
CassandraMappingContext getMappingContext()- Specified by:
getMappingContext
in interfaceEntityConverter<CassandraPersistentEntity<?>,
CassandraPersistentProperty, Object, Object>
-
getColumnTypeResolver
ColumnTypeResolver getColumnTypeResolver()- Returns:
- the
ColumnTypeResolver
- Since:
- 3.0
-
project
Apply a projection toRow
and return the projection return typeR
.Non-projecting
descriptors 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
Id
orPrimaryKey
Id - A
MapId
for compositePrimaryKeyColumn
Id's - A the composite primary key for
PrimaryKey
using 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
-Object
to 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
-Object
to convert; must not be null.typeInformation
-TypeInformation
used 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
-Object
to convert; must not be null.typeDescriptor
-ColumnType
used 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.
-