Search in sources :

Example 1 with AbstractDoubleEncapsulatedExpression

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

the class AbstractActualJPQLQueryFormatter method toStringDoubleEncapsulated.

protected void toStringDoubleEncapsulated(AbstractDoubleEncapsulatedExpressionStateObject stateObject) {
    if (stateObject.isDecorated()) {
        toText(stateObject);
    } else {
        AbstractDoubleEncapsulatedExpression expression = stateObject.getExpression();
        // Identifier
        appendIdentifier((expression != null) ? expression.getActualIdentifier() : stateObject.getIdentifier(), stateObject.getIdentifier());
        // '('
        if (shouldOutput(expression) || expression.hasLeftParenthesis()) {
            writer.append(LEFT_PARENTHESIS);
        } else if (expression.hasSpaceAfterIdentifier()) {
            writer.append(COMMA);
        }
        // First expression
        if (stateObject.hasFirst()) {
            stateObject.getFirst().accept(this);
        }
        // ','
        if (shouldOutput(expression) || expression.hasComma()) {
            writer.append(COMMA);
        }
        if (shouldOutput(expression) || expression.hasSpaceAfterComma()) {
            writer.append(SPACE);
        }
        // Second expression
        if (stateObject.hasSecond()) {
            stateObject.getSecond().accept(this);
        }
        // ')'
        if (shouldOutput(expression) || expression.hasRightParenthesis()) {
            writer.append(RIGHT_PARENTHESIS);
        }
    }
}
Also used : AbstractDoubleEncapsulatedExpression(org.eclipse.persistence.jpa.jpql.parser.AbstractDoubleEncapsulatedExpression)

Aggregations

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