You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2020/09/30 06:58:15 UTC
[camel] branch master updated: CAMEL-15587: Optimize simple
language for boolean values.
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push:
new 359b0c8 CAMEL-15587: Optimize simple language for boolean values.
359b0c8 is described below
commit 359b0c82b87333c6b1ed107260839f5050cc9c7e
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Wed Sep 30 08:57:46 2020 +0200
CAMEL-15587: Optimize simple language for boolean values.
---
.../main/java/org/apache/camel/support/ObjectHelper.java | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/core/camel-support/src/main/java/org/apache/camel/support/ObjectHelper.java b/core/camel-support/src/main/java/org/apache/camel/support/ObjectHelper.java
index e470a84..71d3e70 100644
--- a/core/camel-support/src/main/java/org/apache/camel/support/ObjectHelper.java
+++ b/core/camel-support/src/main/java/org/apache/camel/support/ObjectHelper.java
@@ -123,6 +123,14 @@ public final class ObjectHelper {
Double leftNum = Double.valueOf((String) leftValue);
Double rightNum = (Double) rightValue;
return leftNum.compareTo(rightNum) == 0;
+ } else if (rightValue instanceof Boolean && leftValue instanceof String) {
+ Boolean leftBool = Boolean.valueOf((String) leftValue);
+ Boolean rightBool = (Boolean) rightValue;
+ return leftBool.compareTo(rightBool) == 0;
+ } else if (rightValue instanceof String && leftValue instanceof Boolean) {
+ Boolean leftBool = (Boolean) leftValue;
+ Boolean rightBool = Boolean.valueOf((String) rightValue);
+ return leftBool.compareTo(rightBool) == 0;
}
// try without type coerce
@@ -204,6 +212,14 @@ public final class ObjectHelper {
Double leftNum = Double.valueOf((String) leftValue);
Double rightNum = (Double) rightValue;
return leftNum.compareTo(rightNum);
+ } else if (rightValue instanceof Boolean && leftValue instanceof String) {
+ Boolean leftBool = Boolean.valueOf((String) leftValue);
+ Boolean rightBool = (Boolean) rightValue;
+ return leftBool.compareTo(rightBool);
+ } else if (rightValue instanceof String && leftValue instanceof Boolean) {
+ Boolean leftBool = (Boolean) leftValue;
+ Boolean rightBool = Boolean.valueOf((String) rightValue);
+ return leftBool.compareTo(rightBool);
}
// if both values is numeric then compare using numeric