Interface RelationalConverter

All Known Implementing Classes:
AbstractRelationalConverter, MappingRelationalConverter

public interface RelationalConverter
A RelationalConverter is responsible for converting for values to the native relational representation and vice versa.
Author:
Mark Paluch, Jens Schauder
  • Method Details

    • getConversionService

      ConversionService getConversionService()
      Returns the underlying ConversionService used by the converter.
      Returns:
      never null.
    • getEntityInstantiators

      EntityInstantiators getEntityInstantiators()
      Return the underlying EntityInstantiators.
      Since:
      2.3
    • getMappingContext

      MappingContext<? extends RelationalPersistentEntity<?>, ? extends RelationalPersistentProperty> getMappingContext()
      Returns the underlying MappingContext used by the converter.
      Returns:
      never null
    • getPropertyAccessor

      <T> PersistentPropertyPathAccessor<T> getPropertyAccessor(PersistentEntity<T,?> persistentEntity, T instance)
      Return a PersistentPropertyAccessor to access property values of the instance.
      Parameters:
      persistentEntity - the kind of entity to operate on. Must not be null.
      instance - the instance to operate on. Must not be null.
      Returns:
      guaranteed to be not null.
    • introspectProjection

      <M,D> EntityProjection<M,D> introspectProjection(Class<M> resultType, Class<D> entityType)
      Introspect the given result type in the context of the entity type whether the returned type is a projection and what property paths are participating in the projection.
      Parameters:
      resultType - the type to project on. Must not be null.
      entityType - the source domain type. Must not be null.
      Returns:
      the introspection result.
      Since:
      3.2
      See Also:
    • project

      <R> R project(EntityProjection<R,?> descriptor, RowDocument document)
      Apply a projection to RowDocument and return the projection return type R. Non-projecting descriptors fall back to regular object materialization.
      Parameters:
      descriptor - the projection descriptor, must not be null.
      document - must not be null.
      Returns:
      a new instance of the projection return type R.
      Since:
      3.2
    • read

      <R> R read(Class<R> type, RowDocument source)
      Read a RowDocument into the requested aggregate type.
      Type Parameters:
      R - aggregate type.
      Parameters:
      type - target aggregate type.
      source - source RowDocument.
      Returns:
      the converted object.
      Since:
      3.2
    • readValue

      @Nullable Object readValue(@Nullable Object value, org.springframework.data.core.TypeInformation<?> type)
      Read a relational value into the desired destination type.
      Parameters:
      value - a value as it is returned by the driver accessing the persistence store. May be null.
      type - TypeInformation into which the value is to be converted. Must not be null.
      Returns:
      The converted value. May be null.
    • writeValue

      @Nullable Object writeValue(@Nullable Object value, org.springframework.data.core.TypeInformation<?> type)
      Write a property value into a relational type that can be stored natively.
      Parameters:
      value - a value as it is used in the object model. May be null.
      type - TypeInformation into which the value is to be converted. Must not be null.
      Returns:
      The converted value. May be null.