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

The following examples show how to use org.springframework.expression.spel.ast.OpGE. 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 4 votes vote down vote up
@Nullable
private SpelNodeImpl eatRelationalExpression() {
	SpelNodeImpl expr = eatSumExpression();
	Token relationalOperatorToken = maybeEatRelationalOperator();
	if (relationalOperatorToken != null) {
		Token t = takeToken();  // consume relational operator token
		SpelNodeImpl rhExpr = eatSumExpression();
		checkOperands(t, expr, rhExpr);
		TokenKind tk = relationalOperatorToken.kind;

		if (relationalOperatorToken.isNumericRelationalOperator()) {
			if (tk == TokenKind.GT) {
				return new OpGT(t.startPos, t.endPos, expr, rhExpr);
			}
			if (tk == TokenKind.LT) {
				return new OpLT(t.startPos, t.endPos, expr, rhExpr);
			}
			if (tk == TokenKind.LE) {
				return new OpLE(t.startPos, t.endPos, expr, rhExpr);
			}
			if (tk == TokenKind.GE) {
				return new OpGE(t.startPos, t.endPos, expr, rhExpr);
			}
			if (tk == TokenKind.EQ) {
				return new OpEQ(t.startPos, t.endPos, expr, rhExpr);
			}
			Assert.isTrue(tk == TokenKind.NE, "Not-equals token expected");
			return new OpNE(t.startPos, t.endPos, expr, rhExpr);
		}

		if (tk == TokenKind.INSTANCEOF) {
			return new OperatorInstanceof(t.startPos, t.endPos, expr, rhExpr);
		}

		if (tk == TokenKind.MATCHES) {
			return new OperatorMatches(t.startPos, t.endPos, expr, rhExpr);
		}

		Assert.isTrue(tk == TokenKind.BETWEEN, "Between token expected");
		return new OperatorBetween(t.startPos, t.endPos, expr, rhExpr);
	}
	return expr;
}
 
Example #2
Source File: InternalSpelExpressionParser.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Nullable
private SpelNodeImpl eatRelationalExpression() {
	SpelNodeImpl expr = eatSumExpression();
	Token relationalOperatorToken = maybeEatRelationalOperator();
	if (relationalOperatorToken != null) {
		Token t = takeToken();  // consume relational operator token
		SpelNodeImpl rhExpr = eatSumExpression();
		checkOperands(t, expr, rhExpr);
		TokenKind tk = relationalOperatorToken.kind;

		if (relationalOperatorToken.isNumericRelationalOperator()) {
			int pos = toPos(t);
			if (tk == TokenKind.GT) {
				return new OpGT(pos, expr, rhExpr);
			}
			if (tk == TokenKind.LT) {
				return new OpLT(pos, expr, rhExpr);
			}
			if (tk == TokenKind.LE) {
				return new OpLE(pos, expr, rhExpr);
			}
			if (tk == TokenKind.GE) {
				return new OpGE(pos, expr, rhExpr);
			}
			if (tk == TokenKind.EQ) {
				return new OpEQ(pos, expr, rhExpr);
			}
			Assert.isTrue(tk == TokenKind.NE, "Not-equals token expected");
			return new OpNE(pos, expr, rhExpr);
		}

		if (tk == TokenKind.INSTANCEOF) {
			return new OperatorInstanceof(toPos(t), expr, rhExpr);
		}

		if (tk == TokenKind.MATCHES) {
			return new OperatorMatches(toPos(t), expr, rhExpr);
		}

		Assert.isTrue(tk == TokenKind.BETWEEN, "Between token expected");
		return new OperatorBetween(toPos(t), expr, rhExpr);
	}
	return expr;
}
 
Example #3
Source File: InternalSpelExpressionParser.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
private SpelNodeImpl eatRelationalExpression() {
	SpelNodeImpl expr = eatSumExpression();
	Token relationalOperatorToken = maybeEatRelationalOperator();
	if (relationalOperatorToken != null) {
		Token t = nextToken();  // consume relational operator token
		SpelNodeImpl rhExpr = eatSumExpression();
		checkOperands(t, expr, rhExpr);
		TokenKind tk = relationalOperatorToken.kind;

		if (relationalOperatorToken.isNumericRelationalOperator()) {
			int pos = toPos(t);
			if (tk == TokenKind.GT) {
				return new OpGT(pos, expr, rhExpr);
			}
			if (tk == TokenKind.LT) {
				return new OpLT(pos, expr, rhExpr);
			}
			if (tk == TokenKind.LE) {
				return new OpLE(pos, expr, rhExpr);
			}
			if (tk == TokenKind.GE) {
				return new OpGE(pos, expr, rhExpr);
			}
			if (tk == TokenKind.EQ) {
				return new OpEQ(pos, expr, rhExpr);
			}
			Assert.isTrue(tk == TokenKind.NE, "Not-equals token expected");
			return new OpNE(pos, expr, rhExpr);
		}

		if (tk == TokenKind.INSTANCEOF) {
			return new OperatorInstanceof(toPos(t), expr, rhExpr);
		}

		if (tk == TokenKind.MATCHES) {
			return new OperatorMatches(toPos(t), expr, rhExpr);
		}

		Assert.isTrue(tk == TokenKind.BETWEEN, "Between token expected");
		return new OperatorBetween(toPos(t), expr, rhExpr);
	}
	return expr;
}
 
Example #4
Source File: InternalSpelExpressionParser.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
private SpelNodeImpl eatRelationalExpression() {
	SpelNodeImpl expr = eatSumExpression();
	Token relationalOperatorToken = maybeEatRelationalOperator();
	if (relationalOperatorToken != null) {
		Token t = nextToken();  // consume relational operator token
		SpelNodeImpl rhExpr = eatSumExpression();
		checkOperands(t, expr, rhExpr);
		TokenKind tk = relationalOperatorToken.kind;

		if (relationalOperatorToken.isNumericRelationalOperator()) {
			int pos = toPos(t);
			if (tk == TokenKind.GT) {
				return new OpGT(pos, expr, rhExpr);
			}
			if (tk == TokenKind.LT) {
				return new OpLT(pos, expr, rhExpr);
			}
			if (tk == TokenKind.LE) {
				return new OpLE(pos, expr, rhExpr);
			}
			if (tk == TokenKind.GE) {
				return new OpGE(pos, expr, rhExpr);
			}
			if (tk == TokenKind.EQ) {
				return new OpEQ(pos, expr, rhExpr);
			}
			Assert.isTrue(tk == TokenKind.NE);
			return new OpNE(pos, expr, rhExpr);
		}

		if (tk == TokenKind.INSTANCEOF) {
			return new OperatorInstanceof(toPos(t), expr, rhExpr);
		}

		if (tk == TokenKind.MATCHES) {
			return new OperatorMatches(toPos(t), expr, rhExpr);
		}

		Assert.isTrue(tk == TokenKind.BETWEEN);
		return new OperatorBetween(toPos(t), expr, rhExpr);
	}
	return expr;
}