Class MappingR2dbcConverter
java.lang.Object
org.springframework.data.relational.core.conversion.BasicRelationalConverter
org.springframework.data.r2dbc.convert.MappingR2dbcConverter
- All Implemented Interfaces:
EntityReader<Object,,io.r2dbc.spi.Row> EntityWriter<Object,,OutboundRow> R2dbcConverter,RelationalConverter
Converter for R2DBC.
- Author:
- Mark Paluch, Oliver Drotbohm
-
Constructor Summary
ConstructorsConstructorDescriptionMappingR2dbcConverter(MappingContext<? extends RelationalPersistentEntity<?>, ? extends RelationalPersistentProperty> context) Creates a newMappingR2dbcConvertergivenMappingContext.MappingR2dbcConverter(MappingContext<? extends RelationalPersistentEntity<?>, ? extends RelationalPersistentProperty> context, CustomConversions conversions) -
Method Summary
Modifier and TypeMethodDescriptioncreateCollection(Collection<?> collection, RelationalPersistentProperty property) Writes the givenCollectionusing the givenRelationalPersistentPropertyinformation.getArrayValue(ArrayColumns arrayColumns, RelationalPersistentProperty property, Object value) Convert avalueinto an array representation according toArrayColumns.Class<?>getTargetType(Class<?> valueType) Return the target type for a value considering registered converters.booleanisSimpleType(Class<?> type) Return whether thetypeis a simple type.<T> BiFunction<io.r2dbc.spi.Row,io.r2dbc.spi.RowMetadata, T> populateIdIfNecessary(T object) <R> R<R> RReads the given source into the given type.readValue(Object value, TypeInformation<?> type) Read a relational value into the desireddestination type.voidwrite(Object source, OutboundRow sink) Methods inherited from class org.springframework.data.relational.core.conversion.BasicRelationalConverter
createInstance, getConversions, getConversionService, getEntityInstantiators, getMappingContext, getPropertyAccessor, writeValueMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.data.r2dbc.convert.R2dbcConverter
getConversionService, getMappingContextMethods inherited from interface org.springframework.data.relational.core.conversion.RelationalConverter
createInstance, getEntityInstantiators, getPropertyAccessor, writeValue
-
Constructor Details
-
MappingR2dbcConverter
public MappingR2dbcConverter(MappingContext<? extends RelationalPersistentEntity<?>, ? extends RelationalPersistentProperty> context) Creates a newMappingR2dbcConvertergivenMappingContext.- Parameters:
context- must not be null.
-
MappingR2dbcConverter
public MappingR2dbcConverter(MappingContext<? extends RelationalPersistentEntity<?>, ? extends RelationalPersistentProperty> context, CustomConversions conversions) - Parameters:
context- must not be null.
-
-
Method Details
-
read
- Specified by:
readin interfaceEntityReader<Object,io.r2dbc.spi.Row>
-
read
Description copied from interface:R2dbcConverterReads the given source into the given type.- Specified by:
readin interfaceR2dbcConverter- Parameters:
type- they type to convert the given source to.row- the source to create an object of the given type from.metadata- theRowMetadata.- Returns:
-
readValue
Description copied from interface:RelationalConverterRead a relational value into the desireddestination type.- Specified by:
readValuein interfaceRelationalConverter- Overrides:
readValuein classBasicRelationalConverter- 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.
-
write
- Specified by:
writein interfaceEntityWriter<Object,OutboundRow>
-
createCollection
protected List<Object> createCollection(Collection<?> collection, RelationalPersistentProperty property) Writes the givenCollectionusing the givenRelationalPersistentPropertyinformation.- Parameters:
collection- must not be null.property- must not be null.- Returns:
-
getArrayValue
public Object getArrayValue(ArrayColumns arrayColumns, RelationalPersistentProperty property, Object value) Description copied from interface:R2dbcConverterConvert avalueinto an array representation according toArrayColumns.- Specified by:
getArrayValuein interfaceR2dbcConverter- Parameters:
arrayColumns- dialect-specific array handling configuration.- Returns:
-
getTargetType
Description copied from interface:R2dbcConverterReturn the target type for a value considering registered converters.- Specified by:
getTargetTypein interfaceR2dbcConverter- Parameters:
valueType- must not be null.- Returns:
-
isSimpleType
Description copied from interface:R2dbcConverterReturn whether thetypeis a simple type. Simple types are database primitives or types with a custom mapping strategy.- Specified by:
isSimpleTypein interfaceR2dbcConverter- Parameters:
type- the type to inspect, must not be null.- Returns:
- true if the type is a simple one.
- See Also:
-
populateIdIfNecessary
- Specified by:
populateIdIfNecessaryin interfaceR2dbcConverter- Parameters:
object- must not be null.- Returns:
-