Interface RelationalConverter

All Known Subinterfaces:
JdbcConverter, R2dbcConverter
All Known Implementing Classes:
BasicJdbcConverter, BasicRelationalConverter, MappingR2dbcConverter

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 Summary

    Modifier and Type
    Method
    Description
    <T> T
    createInstance(org.springframework.data.mapping.PersistentEntity<T,RelationalPersistentProperty> entity, Function<org.springframework.data.mapping.Parameter<?,RelationalPersistentProperty>,Object> parameterValueProvider)
    Create a new instance of PersistentEntity given ParameterValueProvider to obtain constructor properties.
    org.springframework.core.convert.ConversionService
    Returns the underlying ConversionService used by the converter.
    org.springframework.data.mapping.model.EntityInstantiators
    Return the underlying EntityInstantiators.
    org.springframework.data.mapping.context.MappingContext<? extends RelationalPersistentEntity<?>,? extends RelationalPersistentProperty>
    Returns the underlying MappingContext used by the converter.
    <T> org.springframework.data.mapping.PersistentPropertyPathAccessor<T>
    getPropertyAccessor(org.springframework.data.mapping.PersistentEntity<T,?> persistentEntity, T instance)
    Return a PersistentPropertyAccessor to access property values of the instance.
    readValue(Object value, org.springframework.data.util.TypeInformation<?> type)
    Read a relational value into the desired destination type.
    writeValue(Object value, org.springframework.data.util.TypeInformation<?> type)
    Write a property value into a relational type that can be stored natively.
  • Method Details

    • getMappingContext

      org.springframework.data.mapping.context.MappingContext<? extends RelationalPersistentEntity<?>,? extends RelationalPersistentProperty> getMappingContext()
      Returns the underlying MappingContext used by the converter.
      Returns:
      never null
    • getConversionService

      org.springframework.core.convert.ConversionService getConversionService()
      Returns the underlying ConversionService used by the converter.
      Returns:
      never null.
    • createInstance

      <T> T createInstance(org.springframework.data.mapping.PersistentEntity<T,RelationalPersistentProperty> entity, Function<org.springframework.data.mapping.Parameter<?,RelationalPersistentProperty>,Object> parameterValueProvider)
      Create a new instance of PersistentEntity given ParameterValueProvider to obtain constructor properties.
      Type Parameters:
      T - the type of entity to create.
      Parameters:
      entity - the kind of entity to create. Must not be null.
      parameterValueProvider - a function that provides the value to pass to a constructor, given a Parameter. Must not be null.
      Returns:
      the instantiated entity. Guaranteed to be not null.
    • getPropertyAccessor

      <T> org.springframework.data.mapping.PersistentPropertyPathAccessor<T> getPropertyAccessor(org.springframework.data.mapping.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.
    • readValue

      @Nullable Object readValue(@Nullable Object value, org.springframework.data.util.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.util.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.
    • getEntityInstantiators

      org.springframework.data.mapping.model.EntityInstantiators getEntityInstantiators()
      Return the underlying EntityInstantiators.
      Returns:
      Since:
      2.3