Class ProtoExpressionResolver

java.lang.Object
org.litebridge.orm.api.select.model.ProtoExpressionResolver
Direct Known Subclasses:
DtoProtoExpressionResolver, SqlProtoExpressionResolver

public abstract class ProtoExpressionResolver extends Object
Resolver for proto-expressions that have not yet been bound to a specific table or context.

This class provides methods for resolving these proto-expressions into final ExpressionSpecs that can be used by the database provider.

  • Constructor Details

    • ProtoExpressionResolver

      public ProtoExpressionResolver()
  • Method Details

    • resolveExpression

      public Stream<ExpressionSpec> resolveExpression(ExpressionSpec expressionSpec, ClauseType clause)
      Resolves a proto-expression into an ExpressionSpec.

      If the input expression is not a Resolvable, it returns the expression as is.

      Parameters:
      expressionSpec - the proto-expression to resolve
      clause - the clause type where the expression is being used
      Returns:
      the resolved ExpressionSpec corresponding to the provided column
    • resolveExpression

      public Stream<ExpressionSpec> resolveExpression(Resolvable resolvable, ClauseType clause)
      Resolves a Resolvable into an ExpressionSpec.

      If the input expression is not a Resolvable, it returns the expression as is.

      Parameters:
      resolvable - the Resolvable to resolve
      clause - the clause type where the expression is being used
      Returns:
      the resolved ExpressionSpec corresponding to the provided column
    • resolveExpressions

      public List<ExpressionSpec> resolveExpressions(List<ExpressionSpec> expressionSpecs, ClauseType clause)
      Resolves a list of expression specifications.
      Parameters:
      expressionSpecs - the list of expression specifications to resolve
      clause - the clause type where the expressions are being used
      Returns:
      the list of resolved expression specifications
    • resolveConvertSpec

      protected Stream<ExpressionSpec> resolveConvertSpec(ConvertSpec<?> convertSpec, ClauseType clause)
      Resolves a convert specification.
      Parameters:
      convertSpec - the convert specification to resolve
      clause - the clause type where the expression is being used
      Returns:
      a stream containing the resolved expression specification
    • isSupported

      public static boolean isSupported(Class<? extends ExpressionSpec> type)
      Checks if a given expression type is supported for resolution.
      Parameters:
      type - the expression type to check
      Returns:
      true if supported, false otherwise
    • resolveSelectField

      protected abstract ColumnExpressionSpec resolveSelectField(Resolvable resolvable, ClauseType clause)
      Resolves a resolvable into a column expression specification.
      Parameters:
      resolvable - the resolvable to resolve
      clause - the clause type where the expression is being used
      Returns:
      the resolved column expression specification
    • resolveSelectField

      protected abstract ColumnExpressionSpec resolveSelectField(QueryField queryField, ClauseType clause)
      Resolves a query field into a column expression specification.
      Parameters:
      queryField - the query field to resolve
      clause - the clause type where the expression is being used
      Returns:
      the resolved column expression specification
    • getColumn

      protected abstract Column getColumn(Resolvable resolvable, ClauseType clause)
      Returns the database column for a resolvable.
      Parameters:
      resolvable - the resolvable to get the column for
      clause - the clause type where the expression is being used
      Returns:
      the database column