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 Details

    • getProjectionFactory

      ProjectionFactory getProjectionFactory()
      Returns the ProjectionFactory for this converter.
      Returns:
      will never be null.
      Since:
      3.4
    • getCustomConversions

      CustomConversions getCustomConversions()
      Returns the CustomConversions for this converter.
      Returns:
      will never be null.
    • getCodecRegistry

      com.datastax.oss.driver.api.core.type.codec.registry.CodecRegistry getCodecRegistry()
      Returns the CodecRegistry registered in the CassandraConverter.
      Returns:
      the CodecRegistry.
      Since:
      3.0
    • getMappingContext

    • getColumnTypeResolver

      ColumnTypeResolver getColumnTypeResolver()
      Returns the ColumnTypeResolver to resolve ColumnType for properties, TypeInformation, and values.
      Returns:
      the ColumnTypeResolver
      Since:
      3.0
    • project

      <R> R project(EntityProjection<R,?> descriptor, com.datastax.oss.driver.api.core.cql.Row row)
      Apply a projection to Row and return the projection return type R. Non-projecting descriptors fall back to regular 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

      @Nullable Object getId(Object object, CassandraPersistentEntity<?> entity)
      Returns the Id for an entity. It can return:
      Parameters:
      object - must not be null.
      entity - must not be null.
      Returns:
      the id value or null, if the id is not set.
    • convertToColumnType

      Object convertToColumnType(Object value)
      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

      default Object convertToColumnType(Object value, TypeInformation<?> typeInformation)
      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

      Object convertToColumnType(Object value, ColumnType typeDescriptor)
      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

      void write(Object source, Object sink, CassandraPersistentEntity<?> entity)
      Converts and writes a source object into a sink using the given CassandraPersistentEntity.
      Parameters:
      source - the source, must not be null.
      sink - must not be null.
      entity - must not be null.