Class QueryMapper
java.lang.Object
org.springframework.data.r2dbc.query.QueryMapper
- Direct Known Subclasses:
UpdateMapper
Maps
CriteriaDefinition
and Sort
objects considering mapping metadata and dialect-specific
conversion.- Author:
- Mark Paluch, Roman Chigvintsev, Manousos Mathioudakis
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static class
Value object to represent a field and its meta-information.protected static class
Extension ofQueryMapper.Field
to be backed with mapping metadata. -
Constructor Summary
ConstructorDescriptionQueryMapper
(R2dbcDialect dialect, R2dbcConverter converter) Creates a newQueryMapper
with the givenR2dbcConverter
. -
Method Summary
Modifier and TypeMethodDescriptionprotected Object
convertValue
(Object value, org.springframework.data.util.TypeInformation<?> typeInformation) org.springframework.r2dbc.core.Parameter
getBindValue
(org.springframework.r2dbc.core.Parameter value) Potentially convert theParameter
.org.springframework.data.domain.Sort
getMappedObject
(org.springframework.data.domain.Sort sort, RelationalPersistentEntity<?> entity) Map theSort
object to apply field name mapping usingthe type to read
.getMappedObject
(Expression expression, RelationalPersistentEntity<?> entity) Map theExpression
object to apply field name mapping usingthe type to read
.getMappedObject
(org.springframework.r2dbc.core.binding.BindMarkers markers, CriteriaDefinition criteria, Table table, RelationalPersistentEntity<?> entity) getMappedObject
(org.springframework.r2dbc.core.binding.BindMarkers markers, Criteria criteria, Table table, RelationalPersistentEntity<?> entity) Deprecated.since 1.1.getMappedSort
(Table table, org.springframework.data.domain.Sort sort, RelationalPersistentEntity<?> entity) Map theSort
object to apply field name mapping usingthe type to read
.protected org.springframework.data.mapping.context.MappingContext<? extends RelationalPersistentEntity<?>,
RelationalPersistentProperty> toSql
(SqlIdentifier identifier) Render aSqlIdentifier
for SQL usage.
-
Constructor Details
-
QueryMapper
Creates a newQueryMapper
with the givenR2dbcConverter
.- Parameters:
dialect
-converter
- must not be null.
-
-
Method Details
-
toSql
Render aSqlIdentifier
for SQL usage. The resulting String might contain quoting characters.- Parameters:
identifier
- the identifier to be rendered.- Returns:
- an identifier String.
- Since:
- 1.1
-
getMappedObject
public org.springframework.data.domain.Sort getMappedObject(org.springframework.data.domain.Sort sort, @Nullable RelationalPersistentEntity<?> entity) Map theSort
object to apply field name mapping usingthe type to read
.- Parameters:
sort
- must not be null.entity
- relatedRelationalPersistentEntity
, can be null.- Returns:
-
getMappedSort
public List<OrderByField> getMappedSort(Table table, org.springframework.data.domain.Sort sort, @Nullable RelationalPersistentEntity<?> entity) Map theSort
object to apply field name mapping usingthe type to read
.- Parameters:
sort
- must not be null.entity
- relatedRelationalPersistentEntity
, can be null.- Returns:
- Since:
- 1.1
-
getMappedObject
public Expression getMappedObject(Expression expression, @Nullable RelationalPersistentEntity<?> entity) Map theExpression
object to apply field name mapping usingthe type to read
.- Parameters:
expression
- must not be null.entity
- relatedRelationalPersistentEntity
, can be null.- Returns:
- the mapped
Expression
. - Since:
- 1.1
-
getMappedObject
public BoundCondition getMappedObject(org.springframework.r2dbc.core.binding.BindMarkers markers, CriteriaDefinition criteria, Table table, @Nullable RelationalPersistentEntity<?> entity) - Parameters:
markers
- bind markers object, must not be null.criteria
- criteria definition to map, must not be null.table
- must not be null.entity
- relatedRelationalPersistentEntity
, can be null.- Returns:
- the mapped
BoundCondition
. - Since:
- 1.1
-
getMappedObject
@Deprecated public BoundCondition getMappedObject(org.springframework.r2dbc.core.binding.BindMarkers markers, Criteria criteria, Table table, @Nullable RelationalPersistentEntity<?> entity) Deprecated.since 1.1.- Parameters:
markers
- bind markers object, must not be null.criteria
- criteria definition to map, must not be null.table
- must not be null.entity
- relatedRelationalPersistentEntity
, can be null.- Returns:
- the mapped
BoundCondition
.
-
getBindValue
public org.springframework.r2dbc.core.Parameter getBindValue(org.springframework.r2dbc.core.Parameter value) Potentially convert theParameter
.- Parameters:
value
-- Returns:
- Since:
- 1.2
-
convertValue
-
getMappingContext
protected org.springframework.data.mapping.context.MappingContext<? extends RelationalPersistentEntity<?>,RelationalPersistentProperty> getMappingContext()
-