public class BasicRelationalConverter extends Object implements RelationalConverter
RelationalConverter that uses a MappingContext to apply basic conversion of relational values to
property values.
Conversion is configurable by providing a customized CustomConversions.
MappingContext,
SimpleTypeHolder,
CustomConversions| Constructor and Description |
|---|
BasicRelationalConverter(org.springframework.data.mapping.context.MappingContext<? extends RelationalPersistentEntity<?>,? extends RelationalPersistentProperty> context)
Creates a new
BasicRelationalConverter given MappingContext. |
BasicRelationalConverter(org.springframework.data.mapping.context.MappingContext<? extends RelationalPersistentEntity<?>,? extends RelationalPersistentProperty> context,
org.springframework.data.convert.CustomConversions conversions)
|
| Modifier and Type | Method and 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.data.convert.CustomConversions |
getConversions() |
ConversionService |
getConversionService()
Returns the underlying
ConversionService used by the converter. |
org.springframework.data.mapping.model.EntityInstantiators |
getEntityInstantiators()
Return the underlying
EntityInstantiators. |
org.springframework.data.mapping.context.MappingContext<? extends RelationalPersistentEntity<?>,? extends RelationalPersistentProperty> |
getMappingContext()
Returns the underlying
MappingContext used by the converter. |
<T> org.springframework.data.mapping.PersistentPropertyAccessor<T> |
getPropertyAccessor(org.springframework.data.mapping.PersistentEntity<T,?> persistentEntity,
T instance)
Return a
PersistentPropertyAccessor to access property values of the instance. |
Object |
readValue(Object value,
org.springframework.data.util.TypeInformation<?> type)
Read a relational value into the desired
destination type. |
Object |
writeValue(Object value,
org.springframework.data.util.TypeInformation<?> type)
Write a property value into a relational type that can be stored natively.
|
public BasicRelationalConverter(org.springframework.data.mapping.context.MappingContext<? extends RelationalPersistentEntity<?>,? extends RelationalPersistentProperty> context)
BasicRelationalConverter given MappingContext.context - must not be null.public BasicRelationalConverter(org.springframework.data.mapping.context.MappingContext<? extends RelationalPersistentEntity<?>,? extends RelationalPersistentProperty> context, org.springframework.data.convert.CustomConversions conversions)
context - must not be null.conversions - must not be null.public ConversionService getConversionService()
RelationalConverterConversionService used by the converter.getConversionService in interface RelationalConverterpublic org.springframework.data.convert.CustomConversions getConversions()
public org.springframework.data.mapping.context.MappingContext<? extends RelationalPersistentEntity<?>,? extends RelationalPersistentProperty> getMappingContext()
RelationalConverterMappingContext used by the converter.getMappingContext in interface RelationalConverterpublic <T> org.springframework.data.mapping.PersistentPropertyAccessor<T> getPropertyAccessor(org.springframework.data.mapping.PersistentEntity<T,?> persistentEntity,
T instance)
RelationalConverterPersistentPropertyAccessor to access property values of the instance.getPropertyAccessor in interface RelationalConverterpersistentEntity - the kind of entity to operate on. Must not be null.instance - the instance to operate on. Must not be null.null.public <T> T createInstance(org.springframework.data.mapping.PersistentEntity<T,RelationalPersistentProperty> entity, Function<org.springframework.data.mapping.Parameter<?,RelationalPersistentProperty>,Object> parameterValueProvider)
RelationalConverterPersistentEntity given ParameterValueProvider to obtain constructor
properties.createInstance in interface RelationalConverterT - the type of entity to create.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.null.@Nullable public Object readValue(@Nullable Object value, org.springframework.data.util.TypeInformation<?> type)
RelationalConverterdestination type.readValue in interface RelationalConvertervalue - 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.null.@Nullable public Object writeValue(@Nullable Object value, org.springframework.data.util.TypeInformation<?> type)
RelationalConverterwriteValue in interface RelationalConvertervalue - 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.null.public org.springframework.data.mapping.model.EntityInstantiators getEntityInstantiators()
RelationalConverterEntityInstantiators.getEntityInstantiators in interface RelationalConverterCopyright © 2017–2023 Pivotal Software, Inc.. All rights reserved.