Class DefaultReactiveDataAccessStrategy
java.lang.Object
org.springframework.data.r2dbc.core.DefaultReactiveDataAccessStrategy
- All Implemented Interfaces:
ReactiveDataAccessStrategy
Default
ReactiveDataAccessStrategy
implementation.- Author:
- Mark Paluch, Louis Morgan, Jens Schauder
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.data.r2dbc.core.ReactiveDataAccessStrategy
ReactiveDataAccessStrategy.NamedParameterProvider
-
Constructor Summary
ConstructorDescriptionDefaultReactiveDataAccessStrategy
(R2dbcDialect dialect, Collection<?> converters) DefaultReactiveDataAccessStrategy
(R2dbcDialect dialect, R2dbcConverter converter) -
Method Summary
Modifier and TypeMethodDescriptionstatic R2dbcConverter
createConverter
(R2dbcDialect dialect, Collection<?> converters) getAllColumns
(Class<?> entityType) getBindValue
(Parameter value) Return a potentially convertedParameter
for strategies that support type conversion.Returns theR2dbcConverter
.getIdentifierColumns
(Class<?> entityType) getOutboundRow
(Object object) Returns aOutboundRow
that maps column names to aParameter
value.<T> BiFunction<io.r2dbc.spi.Row,
io.r2dbc.spi.RowMetadata, T> getRowMapper
(Class<T> typeToRead) Returns theR2dbcDialect
-specificStatementMapper
.getTableName
(Class<?> type) processNamedParameters
(String query, ReactiveDataAccessStrategy.NamedParameterProvider parameterProvider) Expand named parameters and return aPreparedOperation
wrapping the given bindings.renderForGeneratedValues
(SqlIdentifier identifier) Render aSqlIdentifier
in a way suitable for registering it as a generated key with a statement throughStatement#returnGeneratedValues
.toRowDocument
(Class<?> type, io.r2dbc.spi.Readable row, Iterable<? extends io.r2dbc.spi.ReadableMetadata> metadata) Create a flatRowDocument
from a singleRow or Stored Procedure output
.toSql
(SqlIdentifier identifier) Render aSqlIdentifier
for SQL usage.
-
Constructor Details
-
DefaultReactiveDataAccessStrategy
- Parameters:
dialect
- theR2dbcDialect
to use.
-
DefaultReactiveDataAccessStrategy
- Parameters:
dialect
- theR2dbcDialect
to use.converters
- custom converters to register, must not be null.- See Also:
-
DefaultReactiveDataAccessStrategy
- Parameters:
dialect
- theR2dbcDialect
to use.converter
- must not be null.
-
-
Method Details
-
createConverter
- Parameters:
dialect
- must not be null.converters
- must not be null.- Returns:
- the
R2dbcConverter
.
-
getAllColumns
- Specified by:
getAllColumns
in interfaceReactiveDataAccessStrategy
- Returns:
- all column names for a specific type.
-
getIdentifierColumns
- Specified by:
getIdentifierColumns
in interfaceReactiveDataAccessStrategy
- Returns:
- all Id column names for a specific type.
-
getOutboundRow
Description copied from interface:ReactiveDataAccessStrategy
Returns aOutboundRow
that maps column names to aParameter
value.- Specified by:
getOutboundRow
in interfaceReactiveDataAccessStrategy
- Parameters:
object
- must not be null.- Returns:
-
getBindValue
Description copied from interface:ReactiveDataAccessStrategy
Return a potentially convertedParameter
for strategies that support type conversion.- Specified by:
getBindValue
in interfaceReactiveDataAccessStrategy
- Parameters:
value
- must not be null.- Returns:
-
getRowMapper
public <T> BiFunction<io.r2dbc.spi.Row,io.r2dbc.spi.RowMetadata, getRowMapperT> (Class<T> typeToRead) Description copied from interface:ReactiveDataAccessStrategy
- Specified by:
getRowMapper
in interfaceReactiveDataAccessStrategy
- Returns:
-
toRowDocument
public RowDocument toRowDocument(Class<?> type, io.r2dbc.spi.Readable row, Iterable<? extends io.r2dbc.spi.ReadableMetadata> metadata) Description copied from interface:ReactiveDataAccessStrategy
Create a flatRowDocument
from a singleRow or Stored Procedure output
.- Specified by:
toRowDocument
in interfaceReactiveDataAccessStrategy
- Parameters:
type
- the underlying entity type.row
- the row or stored procedure output to retrieve data from.metadata
- readable metadata.- Returns:
- the
RowDocument
containing the data.
-
processNamedParameters
public PreparedOperation<?> processNamedParameters(String query, ReactiveDataAccessStrategy.NamedParameterProvider parameterProvider) Description copied from interface:ReactiveDataAccessStrategy
Expand named parameters and return aPreparedOperation
wrapping the given bindings.- Specified by:
processNamedParameters
in interfaceReactiveDataAccessStrategy
- Parameters:
query
- the query to expand.parameterProvider
- indexed parameter bindings.- Returns:
- the
PreparedOperation
encapsulating expanded SQL and namedBindings.
-
getTableName
- Specified by:
getTableName
in interfaceReactiveDataAccessStrategy
- Returns:
- the table name for the
entity type
.
-
toSql
Description copied from interface:ReactiveDataAccessStrategy
Render aSqlIdentifier
for SQL usage.- Specified by:
toSql
in interfaceReactiveDataAccessStrategy
- Parameters:
identifier
- the identifier to be rendered.- Returns:
- the SQL representation of the identifier with applied, potentially dialect-specific, processing rules.
- See Also:
-
getStatementMapper
Description copied from interface:ReactiveDataAccessStrategy
Returns theR2dbcDialect
-specificStatementMapper
.- Specified by:
getStatementMapper
in interfaceReactiveDataAccessStrategy
- Returns:
- the
R2dbcDialect
-specificStatementMapper
.
-
getConverter
Description copied from interface:ReactiveDataAccessStrategy
Returns theR2dbcConverter
.- Specified by:
getConverter
in interfaceReactiveDataAccessStrategy
- Returns:
- the
R2dbcConverter
.
-
getMappingContext
public MappingContext<RelationalPersistentEntity<?>,? extends RelationalPersistentProperty> getMappingContext() -
renderForGeneratedValues
Description copied from interface:ReactiveDataAccessStrategy
Render aSqlIdentifier
in a way suitable for registering it as a generated key with a statement throughStatement#returnGeneratedValues
.- Specified by:
renderForGeneratedValues
in interfaceReactiveDataAccessStrategy
- Parameters:
identifier
- to render. Must not be null.- Returns:
- rendered identifier. Guaranteed to be not null.
-