public class MappingCassandraConverter extends AbstractCassandraConverter implements CassandraConverter, ApplicationContextAware, BeanClassLoaderAware
Constructor and Description |
---|
MappingCassandraConverter()
Create a new
MappingCassandraConverter with a CassandraMappingContext . |
MappingCassandraConverter(CassandraMappingContext mappingContext)
Create a new
MappingCassandraConverter with the given CassandraMappingContext . |
Modifier and Type | Method and Description |
---|---|
Object |
convertToColumnType(Object obj)
Converts the given object into a value Cassandra will be able to store natively in a column.
|
Object |
convertToColumnType(Object value,
TypeInformation<?> typeInformation)
Converts the given object into a value Cassandra will be able to store natively in a column.
|
Object |
getId(Object object,
CassandraPersistentEntity<?> entity)
Returns the Id for an entity.
|
CassandraMappingContext |
getMappingContext() |
protected Object |
getReadValue(CassandraValueProvider row,
CassandraPersistentProperty property)
Retrieve the value to read for the given
CassandraPersistentProperty from
BasicCassandraRowValueProvider and perform optionally a conversion of collection element types. |
protected Object |
instantiatePrimaryKey(CassandraPersistentEntity<?> entity,
CassandraPersistentProperty keyProperty,
CassandraValueProvider propertyProvider) |
<R> R |
read(Class<R> type,
Object row) |
protected <S> S |
readEntityFromRow(CassandraPersistentEntity<S> entity,
com.datastax.driver.core.Row row) |
protected <S> S |
readEntityFromUdt(CassandraPersistentEntity<S> entity,
com.datastax.driver.core.UDTValue udtValue) |
protected void |
readProperties(CassandraPersistentEntity<?> entity,
CassandraValueProvider valueProvider,
PersistentPropertyAccessor propertyAccessor) |
protected void |
readPropertiesFromRow(CassandraPersistentEntity<?> entity,
CassandraRowValueProvider row,
PersistentPropertyAccessor propertyAccessor) |
protected void |
readProperty(CassandraPersistentEntity<?> entity,
CassandraPersistentProperty property,
CassandraValueProvider valueProvider,
PersistentPropertyAccessor propertyAccessor) |
<R> R |
readRow(Class<R> type,
com.datastax.driver.core.Row row)
Read a
Row into the requested target type . |
void |
setApplicationContext(ApplicationContext applicationContext) |
void |
setBeanClassLoader(ClassLoader classLoader) |
void |
write(Object source,
Object sink) |
void |
write(Object source,
Object sink,
CassandraPersistentEntity<?> entity)
|
protected void |
writeDeleteWhereFromObject(Object object,
com.datastax.driver.core.querybuilder.Delete.Where where,
CassandraPersistentEntity<?> entity) |
protected void |
writeInsertFromWrapper(ConvertingPropertyAccessor accessor,
com.datastax.driver.core.querybuilder.Insert insert,
CassandraPersistentEntity<?> entity) |
protected void |
writeSelectWhereFromObject(Object object,
com.datastax.driver.core.querybuilder.Select.Where where,
CassandraPersistentEntity<?> entity) |
protected void |
writeUDTValueWhereFromObject(ConvertingPropertyAccessor accessor,
com.datastax.driver.core.UDTValue udtValue,
CassandraPersistentEntity<?> entity) |
protected void |
writeUpdateFromObject(Object object,
com.datastax.driver.core.querybuilder.Update update,
CassandraPersistentEntity<?> entity) |
protected void |
writeUpdateFromWrapper(ConvertingPropertyAccessor accessor,
com.datastax.driver.core.querybuilder.Update update,
CassandraPersistentEntity<?> entity) |
afterPropertiesSet, getConversionService, getCustomConversions, setCustomConversions, setInstantiators
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getCustomConversions
getConversionService
public MappingCassandraConverter()
MappingCassandraConverter
with a CassandraMappingContext
.public MappingCassandraConverter(CassandraMappingContext mappingContext)
MappingCassandraConverter
with the given CassandraMappingContext
.mappingContext
- must not be null.public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
setApplicationContext
in interface ApplicationContextAware
BeansException
public void setBeanClassLoader(ClassLoader classLoader)
setBeanClassLoader
in interface BeanClassLoaderAware
public CassandraMappingContext getMappingContext()
getMappingContext
in interface CassandraConverter
getMappingContext
in interface EntityConverter<CassandraPersistentEntity<?>,CassandraPersistentProperty,Object,Object>
public <R> R readRow(Class<R> type, com.datastax.driver.core.Row row)
Row
into the requested target type
.type
- must not be null.row
- must not be null.protected <S> S readEntityFromRow(CassandraPersistentEntity<S> entity, com.datastax.driver.core.Row row)
protected <S> S readEntityFromUdt(CassandraPersistentEntity<S> entity, com.datastax.driver.core.UDTValue udtValue)
protected void readPropertiesFromRow(CassandraPersistentEntity<?> entity, CassandraRowValueProvider row, PersistentPropertyAccessor propertyAccessor)
protected void readProperties(CassandraPersistentEntity<?> entity, CassandraValueProvider valueProvider, PersistentPropertyAccessor propertyAccessor)
protected void readProperty(CassandraPersistentEntity<?> entity, CassandraPersistentProperty property, CassandraValueProvider valueProvider, PersistentPropertyAccessor propertyAccessor)
protected Object instantiatePrimaryKey(CassandraPersistentEntity<?> entity, CassandraPersistentProperty keyProperty, CassandraValueProvider propertyProvider)
public <R> R read(Class<R> type, Object row)
read
in interface EntityReader<Object,Object>
public Object convertToColumnType(Object obj)
CassandraConverter
convertToColumnType
in interface CassandraConverter
obj
- Object
to convert; must not be null.public Object convertToColumnType(Object value, TypeInformation<?> typeInformation)
CassandraConverter
convertToColumnType
in interface CassandraConverter
value
- Object
to convert; must not be null.typeInformation
- TypeInformation
used to describe the object type; must not be null.public void write(Object source, Object sink)
write
in interface EntityWriter<Object,Object>
public void write(Object source, Object sink, CassandraPersistentEntity<?> entity)
CassandraConverter
write
in interface CassandraConverter
source
- the source, must not be null.sink
- must not be null.entity
- must not be null.protected void writeInsertFromWrapper(ConvertingPropertyAccessor accessor, com.datastax.driver.core.querybuilder.Insert insert, CassandraPersistentEntity<?> entity)
protected void writeUpdateFromObject(Object object, com.datastax.driver.core.querybuilder.Update update, CassandraPersistentEntity<?> entity)
protected void writeUpdateFromWrapper(ConvertingPropertyAccessor accessor, com.datastax.driver.core.querybuilder.Update update, CassandraPersistentEntity<?> entity)
protected void writeSelectWhereFromObject(Object object, com.datastax.driver.core.querybuilder.Select.Where where, CassandraPersistentEntity<?> entity)
protected void writeDeleteWhereFromObject(Object object, com.datastax.driver.core.querybuilder.Delete.Where where, CassandraPersistentEntity<?> entity)
protected void writeUDTValueWhereFromObject(ConvertingPropertyAccessor accessor, com.datastax.driver.core.UDTValue udtValue, CassandraPersistentEntity<?> entity)
public Object getId(Object object, CassandraPersistentEntity<?> entity)
CassandraConverter
Id
or
PrimaryKey
IdMapId
for composite PrimaryKeyColumn
Id'sPrimaryKey
using a
PrimaryKeyClass
getId
in interface CassandraConverter
object
- must not be null.entity
- must not be null.@Nullable protected Object getReadValue(CassandraValueProvider row, CassandraPersistentProperty property)
CassandraPersistentProperty
from
BasicCassandraRowValueProvider
and perform optionally a conversion of collection element types.row
- the row.property
- the property.Copyright © 2011–2018 Pivotal Software, Inc.. All rights reserved.