Interface RelationalConverter
- All Known Implementing Classes:
BasicRelationalConverter
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 TypeMethodDescription<T> TcreateInstance(PersistentEntity<T, RelationalPersistentProperty> entity, Function<Parameter<?, RelationalPersistentProperty>, Object> parameterValueProvider) Create a new instance ofPersistentEntitygivenParameterValueProviderto obtain constructor properties.Returns 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.readValue(Object value, TypeInformation<?> type) Read a relational value into the desireddestination type.writeValue(Object value, TypeInformation<?> type) Write a property value into a relational type that can be stored natively.
-
Method Details
-
getMappingContext
MappingContext<? extends RelationalPersistentEntity<?>,? extends RelationalPersistentProperty> getMappingContext()Returns the underlyingMappingContextused by the converter.- Returns:
- never null
-
getConversionService
ConversionService getConversionService()Returns the underlyingConversionServiceused by the converter.- Returns:
- never null.
-
createInstance
<T> T createInstance(PersistentEntity<T, RelationalPersistentProperty> entity, Function<Parameter<?, RelationalPersistentProperty>, Object> parameterValueProvider) Create a new instance ofPersistentEntitygivenParameterValueProviderto obtain constructor properties.- Type Parameters:
T- the type of entity to create.- Parameters:
entity- the kind of entity to create. Must not benull.parameterValueProvider- a function that provides the value to pass to a constructor, given aParameter. Must not benull.- Returns:
- the instantiated entity. Guaranteed to be not
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.
-
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.
-
getEntityInstantiators
EntityInstantiators getEntityInstantiators()Return the underlyingEntityInstantiators.- Returns:
- Since:
- 2.3
-