Search in sources :

Example 1 with AbstractTripleEncapsulatedExpression

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

the class AbstractActualJPQLQueryFormatter method toStringTripleEncapsulated.

protected void toStringTripleEncapsulated(AbstractTripleEncapsulatedExpressionStateObject stateObject) {
    if (stateObject.isDecorated()) {
        toText(stateObject);
    } else {
        AbstractTripleEncapsulatedExpression expression = stateObject.getExpression();
        // Identifier
        appendIdentifier((expression != null) ? expression.getActualIdentifier() : stateObject.getIdentifier(), stateObject.getIdentifier());
        // '('
        if (shouldOutput(expression) || expression.hasLeftParenthesis()) {
            writer.append(LEFT_PARENTHESIS);
        }
        // First expression
        if (stateObject.hasFirst()) {
            stateObject.getFirst().accept(this);
        }
        if (shouldOutput(expression) || expression.hasFirstComma()) {
            writer.append(COMMA);
        }
        if (shouldOutput(expression) || expression.hasSpaceAfterFirstComma()) {
            writer.append(SPACE);
        }
        // Second expression
        if (stateObject.hasSecond()) {
            stateObject.getSecond().accept(this);
        }
        // Third expression
        if (stateObject.hasThird()) {
            if (shouldOutput(expression) || expression.hasSecondComma()) {
                writer.append(COMMA);
            }
            if (shouldOutput(expression) || expression.hasSpaceAfterSecondComma()) {
                writer.append(SPACE);
            }
            stateObject.getThird().accept(this);
        }
        // ')'
        if (shouldOutput(expression) || expression.hasRightParenthesis()) {
            writer.append(RIGHT_PARENTHESIS);
        }
    }
}
Also used : AbstractTripleEncapsulatedExpression(org.eclipse.persistence.jpa.jpql.parser.AbstractTripleEncapsulatedExpression)

Aggregations

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