java.lang.Object
org.litebridge.orm.api.select.model.ProtoExpressionResolver
- Direct Known Subclasses:
DtoProtoExpressionResolver,SqlProtoExpressionResolver
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract ColumngetColumn(Resolvable resolvable, @Nullable OrmTable ormTable, Table table, ClauseType clause) Returns the database column for a resolvable.static booleanisSupported(Class<? extends ExpressionSpec> type) Checks if a given expression type is supported for resolution.protected Stream<ExpressionSpec> resolveConvertSpec(ConvertSpec<?> convertSpec, @Nullable OrmTable ormTable, Table table, @Nullable String tableAlias, ClauseType clause) Resolves a convert specification.resolveExpression(ExpressionSpec expressionSpec, @Nullable OrmTable ormTable, Table table, @Nullable String tableAlias, ClauseType clause) Resolves a proto-expression into anExpressionSpec.resolveExpression(Resolvable resolvable, @Nullable OrmTable ormTable, Table table, @Nullable String tableAlias, ClauseType clause) Resolves aResolvableinto anExpressionSpec.resolveExpressions(List<ExpressionSpec> expressionSpecs, @Nullable OrmTable ormTable, Table table, @Nullable String tableAlias, ClauseType clause) Resolves a list of expression specifications.protected abstract ColumnExpressionSpecresolveSelectColumnSpec(Resolvable resolvable, @Nullable OrmTable ormTable, Table table, @Nullable String tableAlias, ClauseType clause) Resolves a resolvable into a column expression specification.protected abstract Stream<ExpressionSpec> resolveSelectColumnSpec(QueryField queryField, @Nullable OrmTable ormTable, Table table, @Nullable String tableAlias, ClauseType clause) Resolves a query field into a column expression specification.
-
Constructor Details
-
ProtoExpressionResolver
public ProtoExpressionResolver()
-
-
Method Details
-
resolveExpression
public Stream<ExpressionSpec> resolveExpression(ExpressionSpec expressionSpec, @Nullable OrmTable ormTable, Table table, @Nullable String tableAlias, ClauseType clause) Resolves a proto-expression into anExpressionSpec.If the input expression is not a
Resolvable, it returns the expression as is.- Parameters:
expressionSpec- the proto-expression to resolveormTable- the ORM table metadata, ornulltable- the target database tabletableAlias- optional table aliasclause- the clause type where the expression is being used- Returns:
- the resolved
ExpressionSpeccorresponding to the provided column
-
resolveExpression
public Stream<ExpressionSpec> resolveExpression(Resolvable resolvable, @Nullable OrmTable ormTable, Table table, @Nullable String tableAlias, ClauseType clause) Resolves aResolvableinto anExpressionSpec.If the input expression is not a
Resolvable, it returns the expression as is.- Parameters:
resolvable- theResolvableto resolveormTable- the ORM table metadata, ornulltable- the target database tabletableAlias- optional table aliasclause- the clause type where the expression is being used- Returns:
- the resolved
ExpressionSpeccorresponding to the provided column
-
resolveExpressions
public List<ExpressionSpec> resolveExpressions(List<ExpressionSpec> expressionSpecs, @Nullable OrmTable ormTable, Table table, @Nullable String tableAlias, ClauseType clause) Resolves a list of expression specifications.- Parameters:
expressionSpecs- the list of expression specifications to resolveormTable- the ORM table metadata, ornulltable- the target database tableclause- the clause type where the expressions are being used- Returns:
- the list of resolved expression specifications
-
resolveConvertSpec
protected Stream<ExpressionSpec> resolveConvertSpec(ConvertSpec<?> convertSpec, @Nullable OrmTable ormTable, Table table, @Nullable String tableAlias, ClauseType clause) Resolves a convert specification.- Parameters:
convertSpec- the convert specification to resolveormTable- the ORM table metadata, ornulltable- the target database tableclause- the clause type where the expression is being used- Returns:
- a stream containing the resolved expression specification
-
isSupported
Checks if a given expression type is supported for resolution.- Parameters:
type- the expression type to check- Returns:
trueif supported,falseotherwise
-
resolveSelectColumnSpec
protected abstract ColumnExpressionSpec resolveSelectColumnSpec(Resolvable resolvable, @Nullable OrmTable ormTable, Table table, @Nullable String tableAlias, ClauseType clause) Resolves a resolvable into a column expression specification.- Parameters:
resolvable- the resolvable to resolveormTable- the ORM table metadata, ornulltable- the target database tabletableAlias- optional table aliasclause- the clause type where the expression is being used- Returns:
- the resolved column expression specification
-
resolveSelectColumnSpec
protected abstract Stream<ExpressionSpec> resolveSelectColumnSpec(QueryField queryField, @Nullable OrmTable ormTable, Table table, @Nullable String tableAlias, ClauseType clause) Resolves a query field into a column expression specification.- Parameters:
queryField- the query field to resolveormTable- the ORM table metadata, ornulltable- the target database tableclause- the clause type where the expression is being used- Returns:
- the resolved column expression specification
-
getColumn
protected abstract Column getColumn(Resolvable resolvable, @Nullable OrmTable ormTable, Table table, ClauseType clause) Returns the database column for a resolvable.- Parameters:
resolvable- the resolvable to get the column forormTable- the ORM table metadata, ornulltable- the target database tableclause- the clause type where the expression is being used- Returns:
- the database column
-