Class AbstractSqlLikeQueryBuilder.SqlSelectionVisitor

java.lang.Object
io.micronaut.data.model.query.builder.sql.AbstractSqlLikeQueryBuilder.SqlSelectionVisitor
All Implemented Interfaces:
ExpressionVisitor, SelectionVisitor
Direct Known Subclasses:
SqlQueryBuilder.SqlSelectionVisitor
Enclosing class:
AbstractSqlLikeQueryBuilder

protected class AbstractSqlLikeQueryBuilder.SqlSelectionVisitor extends Object implements SelectionVisitor
The selection visitor to construct the query.
Since:
1.0.0
Author:
graemerocher, Denis Stepanov
  • Field Details

    • queryState

      protected final AbstractSqlLikeQueryBuilder.QueryState queryState
    • query

      protected final StringBuilder query
    • annotationMetadata

      protected final io.micronaut.core.annotation.AnnotationMetadata annotationMetadata
    • distinct

      protected final boolean distinct
    • tableAlias

      protected final @Nullable String tableAlias
    • entity

      protected final PersistentEntity entity
    • columnAlias

      protected @Nullable String columnAlias
  • Constructor Details

  • Method Details

    • visit

      public void visit(PersistentPropertyPath<?> persistentPropertyPath)
      Description copied from interface: ExpressionVisitor
      Specified by:
      visit in interface ExpressionVisitor
      Parameters:
      persistentPropertyPath - The persistentPropertyPath
    • visit

      public void visit(AliasedSelection<?> aliasedSelection)
      Description copied from interface: SelectionVisitor
      Specified by:
      visit in interface SelectionVisitor
      Parameters:
      aliasedSelection - The aliasedSelection
    • visit

      public void visit(PersistentEntityRoot<?> entityRoot)
      Description copied from interface: ExpressionVisitor
      Specified by:
      visit in interface ExpressionVisitor
      Parameters:
      entityRoot - The entityRoot
    • visit

      public void visit(PersistentEntitySubquery<?> subquery)
      Description copied from interface: ExpressionVisitor
      Specified by:
      visit in interface ExpressionVisitor
      Parameters:
      subquery - The subquery
    • visit

      public void visit(CompoundSelection<?> compoundSelection)
      Description copied from interface: SelectionVisitor
      Specified by:
      visit in interface SelectionVisitor
      Parameters:
      compoundSelection - The compoundSelection
    • visit

      public void visit(LiteralExpression<?> literalExpression)
      Description copied from interface: ExpressionVisitor
      Specified by:
      visit in interface ExpressionVisitor
      Parameters:
      literalExpression - The literalExpression
    • visit

      public void visit(UnaryExpression<?> unaryExpression)
      Description copied from interface: ExpressionVisitor
      Specified by:
      visit in interface ExpressionVisitor
      Parameters:
      unaryExpression - The unary expression
    • visit

      public void visit(BinaryExpression<?> binaryExpression)
      Description copied from interface: ExpressionVisitor
      Specified by:
      visit in interface ExpressionVisitor
      Parameters:
      binaryExpression - The aggregateExpression
    • visit

      public void visit(IdExpression<?,?> idExpression)
      Description copied from interface: ExpressionVisitor
      Specified by:
      visit in interface ExpressionVisitor
      Parameters:
      idExpression - The idExpression
    • visit

      public void visit(FunctionExpression<?> functionExpression)
      Description copied from interface: ExpressionVisitor
      Specified by:
      visit in interface ExpressionVisitor
      Parameters:
      functionExpression - The function expression
    • visit

      public void visit(CurrentTemporalExpression<?> currentTemporalExpression)
      Description copied from interface: ExpressionVisitor
      Specified by:
      visit in interface ExpressionVisitor
      Parameters:
      currentTemporalExpression - The current temporal expression
    • visit

      public void visit(IParameterExpression<?> parameterExpression)
      Description copied from interface: ExpressionVisitor
      Specified by:
      visit in interface ExpressionVisitor
      Specified by:
      visit in interface SelectionVisitor
      Parameters:
      parameterExpression - The parameter expression
    • visit

      public void visit(CastExpression<?> castExpression)
      Description copied from interface: ExpressionVisitor
      Specified by:
      visit in interface ExpressionVisitor
      Parameters:
      castExpression - The cast expression
    • appendCompoundPropertyProjection

      @Internal protected void appendCompoundPropertyProjection(PersistentPropertyPath propertyPath)
      Appends the compound (part of entity or DTO) property projection.
      Parameters:
      propertyPath - The property path
    • appendCompoundAssociationProjection

      @Internal protected void appendCompoundAssociationProjection(PersistentAssociationPath propertyPath)
      Appends the compound (part of entity or DTO) association projection.
      Parameters:
      propertyPath - The property path
    • appendCompoundProjection

      @Internal protected void appendCompoundProjection(PersistentPropertyPath propertyPath)
      Appends the compound (part of entity or DTO) association projection.
      Parameters:
      propertyPath - The property path
    • appendPropertyProjection

      protected void appendPropertyProjection(AbstractSqlLikeQueryBuilder.QueryPropertyPath propertyPath)
      Append the property projection.
      Parameters:
      propertyPath - The property
    • appendAssociationProjection

      protected void appendAssociationProjection(PersistentAssociationPath associationPath)
      Appends selection projection for the property which is association.
      Parameters:
      associationPath - the persistent property path
    • appendRowCount

      protected void appendRowCount(String logicalName)
      Appends a row count projection to the query string.
      Parameters:
      logicalName - The alias to the table name
    • appendRowCountDistinct

      protected void appendRowCountDistinct(String logicalName)
      Appends a row count distinct projection to the query string.
      Parameters:
      logicalName - The alias to the table name
    • selectAllColumns

      protected void selectAllColumns(io.micronaut.core.annotation.AnnotationMetadata annotationMetadata, PersistentEntity persistentEntity, @Nullable String tableAlias)
      Select all the columns from the entity.
      Parameters:
      annotationMetadata - The annotation metadata
      persistentEntity - The persistent entity
      tableAlias - The table alias
    • selectAllColumnsAndJoined

      protected void selectAllColumnsAndJoined()
      Select all the columns from the entity and the joined entities.
    • selectAllColumnsFromJoinPaths

      protected void selectAllColumnsFromJoinPaths(Collection<JoinPath> allPaths, @Nullable Map<JoinPath,String> joinAliasOverride)
      Does nothing but subclasses might override and implement new behavior.
      Parameters:
      allPaths - The join paths
      joinAliasOverride - The join alias override
    • appendProperty

      protected final void appendProperty(StringBuilder sb, List<Association> associations, PersistentProperty property, NamingStrategy namingStrategy, @Nullable String tableAlias, boolean escape)
    • appendProperty

      @Internal protected final void appendProperty(StringBuilder sb, List<Association> associations, PersistentProperty property, NamingStrategy namingStrategy, @Nullable String tableAlias, boolean escape, @Nullable String targetName, boolean explicitAlias)
      Appends the property column followed by a comma.
      Parameters:
      sb - The query builder
      associations - The associations
      property - The property
      namingStrategy - The naming strategy used to resolve the column name
      tableAlias - The table alias
      escape - Whether to escape the column
      targetName - The result column name, escaped like the column. If not set, the property column alias is used
      explicitAlias - Whether the caller will append an explicit projection alias
    • getGeometryFunction

      protected String getGeometryFunction(String column, PersistentProperty property)
      Wraps a geometry column in the dialect-specific function that reads it as GeoJSON or WKT, depending on the property converter.
      Parameters:
      column - The column, qualified with the table alias
      property - The geometry property
      Returns:
      The select expression including the alias