gnodet-bot commented on code in PR #26806:
URL: https://github.com/apache/camel/pull/26806#discussion_r4085368425
##########
core/camel-core-languages/src/main/java/org/apache/camel/language/simple/ast/LogicalExpression.java:
##########
@@ -93,40 +93,22 @@ public Expression createExpression(CamelContext
camelContext, String expression)
final Expression leftExp = left.createExpression(camelContext,
expression);
final Expression rightExp = right.createExpression(camelContext,
expression);
+ // build the predicate once, not for every message
+ final Predicate leftPredicate =
ExpressionToPredicateAdapter.toPredicate(leftExp);
+ final Predicate rightPredicate =
ExpressionToPredicateAdapter.toPredicate(rightExp);
if (operator == LogicalOperatorType.AND) {
- return createAndExpression(leftExp, rightExp);
+ return createExpression(PredicateBuilder.and(leftPredicate,
rightPredicate));
} else if (operator == LogicalOperatorType.OR) {
- return createOrExpression(leftExp, rightExp);
+ return createExpression(PredicateBuilder.or(leftPredicate,
rightPredicate));
}
throw new SimpleParserException("Unknown logical operator " +
operator, token.getIndex());
}
- private Expression createAndExpression(final Expression leftExp, final
Expression rightExp) {
+ private Expression createExpression(final Predicate predicate) {
return new Expression() {
Review Comment:
test comment
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]