Search in sources :

Example 1 with ExpressionModifier

use of com.blazebit.persistence.parser.expression.modifier.ExpressionModifier in project blaze-persistence by Blazebit.

the class AbstractCommonQueryBuilder method inlineSelectAlias.

void inlineSelectAlias(String selectAlias, Expression expression) {
    final AliasReplacementVisitor aliasReplacementVisitor = new AliasReplacementVisitor(expression, selectAlias);
    ExpressionModifierVisitor<ExpressionModifier> expressionModifierVisitor = new ExpressionModifierVisitor<ExpressionModifier>() {

        @Override
        public void visit(ExpressionModifier expressionModifier, ClauseType clauseType) {
            Expression expr = expressionModifier.get();
            Expression newExpr = expr.accept(aliasReplacementVisitor);
            if (expr != newExpr) {
                expressionModifier.set(newExpr);
            }
        }
    };
    joinManager.apply(expressionModifierVisitor);
    selectManager.apply(expressionModifierVisitor);
    whereManager.apply(expressionModifierVisitor);
    havingManager.apply(expressionModifierVisitor);
    groupByManager.apply(expressionModifierVisitor);
    orderByManager.apply(expressionModifierVisitor);
}
Also used : AliasReplacementVisitor(com.blazebit.persistence.parser.AliasReplacementVisitor) ParameterExpression(javax.persistence.criteria.ParameterExpression) ArrayExpression(com.blazebit.persistence.parser.expression.ArrayExpression) FunctionExpression(com.blazebit.persistence.parser.expression.FunctionExpression) PathElementExpression(com.blazebit.persistence.parser.expression.PathElementExpression) Expression(com.blazebit.persistence.parser.expression.Expression) PathExpression(com.blazebit.persistence.parser.expression.PathExpression) PropertyExpression(com.blazebit.persistence.parser.expression.PropertyExpression) SubqueryExpression(com.blazebit.persistence.parser.expression.SubqueryExpression) ExpressionModifier(com.blazebit.persistence.parser.expression.modifier.ExpressionModifier) ExpressionModifierVisitor(com.blazebit.persistence.impl.transform.ExpressionModifierVisitor)

Aggregations

ExpressionModifierVisitor (com.blazebit.persistence.impl.transform.ExpressionModifierVisitor)1 AliasReplacementVisitor (com.blazebit.persistence.parser.AliasReplacementVisitor)1 ArrayExpression (com.blazebit.persistence.parser.expression.ArrayExpression)1 Expression (com.blazebit.persistence.parser.expression.Expression)1 FunctionExpression (com.blazebit.persistence.parser.expression.FunctionExpression)1 PathElementExpression (com.blazebit.persistence.parser.expression.PathElementExpression)1 PathExpression (com.blazebit.persistence.parser.expression.PathExpression)1 PropertyExpression (com.blazebit.persistence.parser.expression.PropertyExpression)1 SubqueryExpression (com.blazebit.persistence.parser.expression.SubqueryExpression)1 ExpressionModifier (com.blazebit.persistence.parser.expression.modifier.ExpressionModifier)1 ParameterExpression (javax.persistence.criteria.ParameterExpression)1