Class QueryMapper

java.lang.Object
org.springframework.data.r2dbc.query.QueryMapper
Direct Known Subclasses:
UpdateMapper

public class QueryMapper extends Object
Maps CriteriaDefinition and Sort objects considering mapping metadata and dialect-specific conversion.
Author:
Mark Paluch, Roman Chigvintsev, Manousos Mathioudakis, Jens Schauder, Yan Qiang
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    protected static class 
    Value object to represent a field and its meta-information.
    protected static class 
    Extension of QueryMapper.Field to be backed with mapping metadata.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new QueryMapper with the given R2dbcConverter.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected @Nullable Object
    convertValue(@Nullable Object value, org.springframework.data.core.TypeInformation<?> typeInformation)
     
    Potentially convert the Parameter.
    org.springframework.data.relational.core.sql.Expression
    getMappedObject(org.springframework.data.relational.core.sql.Expression expression, @Nullable org.springframework.data.relational.core.mapping.RelationalPersistentEntity<?> entity)
    Deprecated.
    since 4.0 in favor of getMappedObjects(Expression, RelationalPersistentEntity) where usage of embeddable properties can return more than one mapped result.
    getMappedObject(BindMarkers markers, org.springframework.data.relational.core.query.CriteriaDefinition criteria, org.springframework.data.relational.core.sql.Table table, @Nullable org.springframework.data.relational.core.mapping.RelationalPersistentEntity<?> entity)
    Map a CriteriaDefinition object into Condition and consider value/NULL Bindings.
    List<org.springframework.data.relational.core.sql.Expression>
    getMappedObjects(org.springframework.data.relational.core.sql.Expression expression, @Nullable org.springframework.data.relational.core.mapping.RelationalPersistentEntity<?> entity)
    Map the Expression object to apply field name mapping using the type to read.
    List<org.springframework.data.relational.core.sql.OrderByField>
    getMappedSort(org.springframework.data.relational.core.sql.Table table, Sort sort, @Nullable org.springframework.data.relational.core.mapping.RelationalPersistentEntity<?> entity)
    Map the Sort object to apply field name mapping using the type to read.
    protected MappingContext<? extends org.springframework.data.relational.core.mapping.RelationalPersistentEntity<?>, org.springframework.data.relational.core.mapping.RelationalPersistentProperty>
     
    toSql(org.springframework.data.relational.core.sql.SqlIdentifier identifier)
    Render a SqlIdentifier for SQL usage.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • toSql

      public String toSql(org.springframework.data.relational.core.sql.SqlIdentifier identifier)
      Render a SqlIdentifier for SQL usage. The resulting String might contain quoting characters.
      Parameters:
      identifier - the identifier to be rendered.
      Returns:
      an identifier String.
      Since:
      1.1
    • getMappedSort

      public List<org.springframework.data.relational.core.sql.OrderByField> getMappedSort(org.springframework.data.relational.core.sql.Table table, Sort sort, @Nullable org.springframework.data.relational.core.mapping.RelationalPersistentEntity<?> entity)
      Map the Sort object to apply field name mapping using the type to read.
      Parameters:
      sort - must not be null.
      entity - related RelationalPersistentEntity, can be null.
      Returns:
      Since:
      1.1
    • getMappedObject

      @Deprecated(since="4.0") public org.springframework.data.relational.core.sql.Expression getMappedObject(org.springframework.data.relational.core.sql.Expression expression, @Nullable org.springframework.data.relational.core.mapping.RelationalPersistentEntity<?> entity)
      Deprecated.
      since 4.0 in favor of getMappedObjects(Expression, RelationalPersistentEntity) where usage of embeddable properties can return more than one mapped result.
      Map the Expression object to apply field name mapping using the type to read.
      Parameters:
      expression - must not be null.
      entity - related RelationalPersistentEntity, can be null.
      Returns:
      the mapped Expression.
      Since:
      1.1
    • getMappedObjects

      public List<org.springframework.data.relational.core.sql.Expression> getMappedObjects(org.springframework.data.relational.core.sql.Expression expression, @Nullable org.springframework.data.relational.core.mapping.RelationalPersistentEntity<?> entity)
      Map the Expression object to apply field name mapping using the type to read.
      Parameters:
      expression - must not be null.
      entity - related RelationalPersistentEntity, can be null.
      Returns:
      the mapped Expressions.
      Since:
      4.0
    • getMappedObject

      public BoundCondition getMappedObject(BindMarkers markers, org.springframework.data.relational.core.query.CriteriaDefinition criteria, org.springframework.data.relational.core.sql.Table table, @Nullable org.springframework.data.relational.core.mapping.RelationalPersistentEntity<?> entity)
      Map a CriteriaDefinition object into Condition and consider value/NULL Bindings.
      Parameters:
      markers - bind markers object, must not be null.
      criteria - criteria definition to map, must not be null.
      table - must not be null.
      entity - related RelationalPersistentEntity, can be null.
      Returns:
      the mapped BoundCondition.
      Since:
      1.1
    • getBindValue

      public Parameter getBindValue(Parameter value)
      Potentially convert the Parameter.
      Parameters:
      value -
      Returns:
      Since:
      1.2
    • convertValue

      protected @Nullable Object convertValue(@Nullable Object value, org.springframework.data.core.TypeInformation<?> typeInformation)
    • getMappingContext

      protected MappingContext<? extends org.springframework.data.relational.core.mapping.RelationalPersistentEntity<?>, org.springframework.data.relational.core.mapping.RelationalPersistentProperty> getMappingContext()