org.springframework.expression.spel.ast.Selection Java Examples

The following examples show how to use org.springframework.expression.spel.ast.Selection. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: InternalSpelExpressionParser.java    From spring-analysis-note with MIT License 6 votes vote down vote up
private boolean maybeEatSelection(boolean nullSafeNavigation) {
	Token t = peekToken();
	if (!peekSelectToken()) {
		return false;
	}
	Assert.state(t != null, "No token");
	nextToken();
	SpelNodeImpl expr = eatExpression();
	if (expr == null) {
		throw internalException(t.startPos, SpelMessage.MISSING_SELECTION_EXPRESSION);
	}
	eatToken(TokenKind.RSQUARE);
	if (t.kind == TokenKind.SELECT_FIRST) {
		this.constructedNodes.push(new Selection(nullSafeNavigation, Selection.FIRST, t.startPos, t.endPos, expr));
	}
	else if (t.kind == TokenKind.SELECT_LAST) {
		this.constructedNodes.push(new Selection(nullSafeNavigation, Selection.LAST, t.startPos, t.endPos, expr));
	}
	else {
		this.constructedNodes.push(new Selection(nullSafeNavigation, Selection.ALL, t.startPos, t.endPos, expr));
	}
	return true;
}
 
Example #2
Source File: InternalSpelExpressionParser.java    From java-technology-stack with MIT License 6 votes vote down vote up
private boolean maybeEatSelection(boolean nullSafeNavigation) {
	Token t = peekToken();
	if (!peekSelectToken()) {
		return false;
	}
	Assert.state(t != null, "No token");
	nextToken();
	SpelNodeImpl expr = eatExpression();
	if (expr == null) {
		throw internalException(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;
}
 
Example #3
Source File: InternalSpelExpressionParser.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example #4
Source File: InternalSpelExpressionParser.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
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;
}