Search in sources :

Example 1 with TreatExpression

use of org.eclipse.persistence.jpa.jpql.parser.TreatExpression in project eclipselink by eclipse-ee4j.

the class AbstractActualJPQLQueryFormatter method visit.

@Override
public void visit(TreatExpressionStateObject stateObject) {
    if (stateObject.isDecorated()) {
        toText(stateObject);
    } else {
        TreatExpression expression = stateObject.getExpression();
        // TREAT
        appendIdentifier((expression != null) ? expression.getActualIdentifier() : TREAT, TREAT);
        // (
        if (shouldOutput(expression) || expression.hasLeftParenthesis()) {
            writer.append(LEFT_PARENTHESIS);
        }
        // Join association path expression
        stateObject.getJoinAssociationPathStateObject().accept(this);
        if (shouldOutput(expression) || expression.hasSpaceAfterCollectionValuedPathExpression()) {
            writer.append(SPACE);
        }
        // AS
        if (stateObject.hasAs()) {
            appendIdentifier((expression != null) ? expression.getActualAsIdentifier() : AS, AS);
            if (shouldOutput(expression) || expression.hasSpaceAfterAs()) {
                writer.append(SPACE);
            }
        }
        // Entity type name
        writer.append(stateObject.getEntityTypeName());
        // )
        if (shouldOutput(expression) || expression.hasRightParenthesis()) {
            writer.append(RIGHT_PARENTHESIS);
        }
    }
}
Also used : TreatExpression(org.eclipse.persistence.jpa.jpql.parser.TreatExpression)

Aggregations

TreatExpression (org.eclipse.persistence.jpa.jpql.parser.TreatExpression)1