Interface RelationalConverter
- All Known Subinterfaces:
JdbcConverter,R2dbcConverter
- All Known Implementing Classes:
AbstractRelationalConverter,MappingJdbcConverter,MappingR2dbcConverter,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 Summary
Modifier and TypeMethodDescriptionReturns the underlyingConversionServiceused by the converter.Return the underlyingEntityInstantiators.MappingContext<? extends RelationalPersistentEntity<?>,? extends RelationalPersistentProperty> Returns the underlyingMappingContextused by the converter.getPropertyAccessor(PersistentEntity<T, ?> persistentEntity, T instance) Return aPersistentPropertyAccessorto access property values of theinstance.<M,D> EntityProjection<M, D> introspectProjection(Class<M> resultType, Class<D> entityType) Introspect the givenresult typein the context of theentity typewhether the returned type is a projection and what property paths are participating in the projection.<R> Rproject(EntityProjection<R, ?> descriptor, RowDocument document) Apply a projection toRowDocumentand return the projection return typeR.<R> Rread(Class<R> type, RowDocument source) Read aRowDocumentinto the requestedaggregate type.@Nullable ObjectreadValue(@Nullable Object value, TypeInformation<?> type) Read a relational value into the desireddestination type.@Nullable ObjectwriteValue(@Nullable Object value, TypeInformation<?> type) Write a property value into a relational type that can be stored natively.
-
Method Details
-
getConversionService
ConversionService getConversionService()Returns the underlyingConversionServiceused by the converter.- Returns:
- never null.
-
getEntityInstantiators
EntityInstantiators getEntityInstantiators()Return the underlyingEntityInstantiators.- Since:
- 2.3
-
getMappingContext
MappingContext<? extends RelationalPersistentEntity<?>,? extends RelationalPersistentProperty> getMappingContext()Returns the underlyingMappingContextused by the converter.- Returns:
- never null
-
getPropertyAccessor
<T> PersistentPropertyPathAccessor<T> getPropertyAccessor(PersistentEntity<T, ?> persistentEntity, T instance) Return aPersistentPropertyAccessorto access property values of theinstance.- Parameters:
persistentEntity- the kind of entity to operate on. Must not benull.instance- the instance to operate on. Must not benull.- Returns:
- guaranteed to be not
null.
-
introspectProjection
Introspect the givenresult typein the context of theentity typewhether 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
Apply a projection toRowDocumentand return the projection return typeR.Non-projectingdescriptors fall back toregular 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
Read aRowDocumentinto the requestedaggregate type.- Type Parameters:
R- aggregate type.- Parameters:
type- target aggregate type.source- sourceRowDocument.- Returns:
- the converted object.
- Since:
- 3.2
-
readValue
Read a relational value into the desireddestination type.- Parameters:
value- a value as it is returned by the driver accessing the persistence store. May benull.type-TypeInformationinto which the value is to be converted. Must not benull.- Returns:
- The converted value. May be
null.
-
writeValue
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 benull.type-TypeInformationinto which the value is to be converted. Must not benull.- Returns:
- The converted value. May be
null.
-