Search in sources :

Example 1 with Selection

use of org.springframework.expression.spel.ast.Selection in project spring-framework by spring-projects.

the class InternalSpelExpressionParser method maybeEatSelection.

private boolean maybeEatSelection(boolean nullSafeNavigation) {
    Token t = peekToken();
    if (!peekSelectToken()) {
        return false;
    }
    nextToken();
    SpelNodeImpl expr = eatExpression();
    if (expr == null) {
        raiseInternalException(toPos(t), SpelMessage.MISSING_SELECTION_EXPRESSION);
    }
    eatToken(TokenKind.RSQUARE);
    if (t.kind == TokenKind.SELECT_FIRST) {
        this.constructedNodes.push(new Selection(nullSafeNavigation, Selection.FIRST, toPos(t), expr));
    } else if (t.kind == TokenKind.SELECT_LAST) {
        this.constructedNodes.push(new Selection(nullSafeNavigation, Selection.LAST, toPos(t), expr));
    } else {
        this.constructedNodes.push(new Selection(nullSafeNavigation, Selection.ALL, toPos(t), expr));
    }
    return true;
}
Also used : SpelNodeImpl(org.springframework.expression.spel.ast.SpelNodeImpl) Selection(org.springframework.expression.spel.ast.Selection)

Aggregations

Selection (org.springframework.expression.spel.ast.Selection)1 SpelNodeImpl (org.springframework.expression.spel.ast.SpelNodeImpl)1