You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by fm...@apache.org on 2026/01/19 11:46:38 UTC
(camel) 02/23: CAMEL-22867: camel-core - Deprecate binary operators in simple langua… (#20861)
This is an automated email from the ASF dual-hosted git repository.
fmariani pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 3d66046f2e794f63027d5235696e10a38e9c0600
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sat Jan 17 16:14:06 2026 +0100
CAMEL-22867: camel-core - Deprecate binary operators in simple langua… (#20861)
* CAMEL-22867: camel-core - Deprecate binary operators in simple language with space in name
---
.../modules/languages/pages/simple-language.adoc | 4 ---
.../camel/language/simple/SimpleTokenizer.java | 10 +++---
.../language/simple/types/BinaryOperatorType.java | 40 ++++++++++++++++++----
.../ROOT/pages/camel-4x-upgrade-guide-4_18.adoc | 12 +++++++
4 files changed, 50 insertions(+), 16 deletions(-)
diff --git a/core/camel-core-languages/src/main/docs/modules/languages/pages/simple-language.adoc b/core/camel-core-languages/src/main/docs/modules/languages/pages/simple-language.adoc
index bd658b2ebc9a..c2ecaeb63264 100644
--- a/core/camel-core-languages/src/main/docs/modules/languages/pages/simple-language.adoc
+++ b/core/camel-core-languages/src/main/docs/modules/languages/pages/simple-language.adoc
@@ -635,12 +635,8 @@ defined as numbers: `from..to`. .
|startsWith |For testing if the left-hand side string starts
with the right-hand string.
-|starts with |Same as the startsWith operator.
-
|endsWith |For testing if the left-hand side string ends with
the right-hand string.
-
-|ends with |Same as the endsWith operator.
|===
And the following unary operators can be used:
diff --git a/core/camel-core-languages/src/main/java/org/apache/camel/language/simple/SimpleTokenizer.java b/core/camel-core-languages/src/main/java/org/apache/camel/language/simple/SimpleTokenizer.java
index f898c4885079..506e07fbfa0b 100644
--- a/core/camel-core-languages/src/main/java/org/apache/camel/language/simple/SimpleTokenizer.java
+++ b/core/camel-core-languages/src/main/java/org/apache/camel/language/simple/SimpleTokenizer.java
@@ -64,24 +64,24 @@ public final class SimpleTokenizer {
KNOWN_TOKENS[21] = new SimpleTokenType(TokenType.binaryOperator, "not is");
KNOWN_TOKENS[22] = new SimpleTokenType(TokenType.binaryOperator, "!is");
KNOWN_TOKENS[23] = new SimpleTokenType(TokenType.binaryOperator, "is");
- KNOWN_TOKENS[24] = new SimpleTokenType(TokenType.binaryOperator, "not contains");
+ KNOWN_TOKENS[24] = new SimpleTokenType(TokenType.binaryOperator, "not contains"); // deprecated
KNOWN_TOKENS[25] = new SimpleTokenType(TokenType.binaryOperator, "!contains");
KNOWN_TOKENS[26] = new SimpleTokenType(TokenType.binaryOperator, "contains");
KNOWN_TOKENS[27] = new SimpleTokenType(TokenType.binaryOperator, "!~~");
KNOWN_TOKENS[28] = new SimpleTokenType(TokenType.binaryOperator, "~~");
- KNOWN_TOKENS[29] = new SimpleTokenType(TokenType.binaryOperator, "not regex");
+ KNOWN_TOKENS[29] = new SimpleTokenType(TokenType.binaryOperator, "not regex"); // deprecated
KNOWN_TOKENS[30] = new SimpleTokenType(TokenType.binaryOperator, "!regex");
KNOWN_TOKENS[31] = new SimpleTokenType(TokenType.binaryOperator, "regex");
KNOWN_TOKENS[32] = new SimpleTokenType(TokenType.binaryOperator, "not in");
KNOWN_TOKENS[33] = new SimpleTokenType(TokenType.binaryOperator, "!in");
KNOWN_TOKENS[34] = new SimpleTokenType(TokenType.binaryOperator, "in");
- KNOWN_TOKENS[35] = new SimpleTokenType(TokenType.binaryOperator, "not range");
+ KNOWN_TOKENS[35] = new SimpleTokenType(TokenType.binaryOperator, "not range"); // deprecated
KNOWN_TOKENS[36] = new SimpleTokenType(TokenType.binaryOperator, "!range");
KNOWN_TOKENS[37] = new SimpleTokenType(TokenType.binaryOperator, "range");
KNOWN_TOKENS[38] = new SimpleTokenType(TokenType.binaryOperator, "startsWith");
- KNOWN_TOKENS[39] = new SimpleTokenType(TokenType.binaryOperator, "starts with");
+ KNOWN_TOKENS[39] = new SimpleTokenType(TokenType.binaryOperator, "starts with"); // deprecated
KNOWN_TOKENS[40] = new SimpleTokenType(TokenType.binaryOperator, "endsWith");
- KNOWN_TOKENS[41] = new SimpleTokenType(TokenType.binaryOperator, "ends with");
+ KNOWN_TOKENS[41] = new SimpleTokenType(TokenType.binaryOperator, "ends with"); // deprecated
// unary operators
KNOWN_TOKENS[42] = new SimpleTokenType(TokenType.unaryOperator, "++");
diff --git a/core/camel-core-languages/src/main/java/org/apache/camel/language/simple/types/BinaryOperatorType.java b/core/camel-core-languages/src/main/java/org/apache/camel/language/simple/types/BinaryOperatorType.java
index 46c24968580a..c0b8dca08267 100644
--- a/core/camel-core-languages/src/main/java/org/apache/camel/language/simple/types/BinaryOperatorType.java
+++ b/core/camel-core-languages/src/main/java/org/apache/camel/language/simple/types/BinaryOperatorType.java
@@ -16,6 +16,9 @@
*/
package org.apache.camel.language.simple.types;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
/**
* Types of binary operators supported
*/
@@ -44,6 +47,8 @@ public enum BinaryOperatorType {
STARTS_WITH,
ENDS_WITH;
+ private static final Logger LOG = LoggerFactory.getLogger(BinaryOperatorType.class);
+
public static BinaryOperatorType asOperator(String text) {
if ("==".equals(text)) {
return EQ;
@@ -63,7 +68,10 @@ public enum BinaryOperatorType {
return NOT_EQ_IGNORE;
} else if ("contains".equals(text)) {
return CONTAINS;
- } else if ("!contains".equals(text) || "not contains".equals(text)) {
+ } else if ("!contains".equals(text)) {
+ return NOT_CONTAINS;
+ } else if ("not contains".equals(text)) {
+ LOG.warn("Simple operator `not contains` is deprecated, use `!contains` instead");
return NOT_CONTAINS;
} else if ("~~".equals(text)) {
return CONTAINS_IGNORECASE;
@@ -71,23 +79,41 @@ public enum BinaryOperatorType {
return NOT_CONTAINS_IGNORECASE;
} else if ("regex".equals(text)) {
return REGEX;
- } else if ("!regex".equals(text) || "not regex".equals(text)) {
+ } else if ("!regex".equals(text)) {
+ return NOT_REGEX;
+ } else if ("not regex".equals(text)) {
+ LOG.warn("Simple operator `not regex` is deprecated, use `!regex` instead");
return NOT_REGEX;
} else if ("in".equals(text)) {
return IN;
- } else if ("!in".equals(text) || "not in".equals(text)) {
+ } else if ("!in".equals(text)) {
+ return NOT_IN;
+ } else if ("not in".equals(text)) {
+ LOG.warn("Simple operator `not in` is deprecated, use `!in` instead");
return NOT_IN;
} else if ("is".equals(text)) {
return IS;
- } else if ("!is".equals(text) || "not is".equals(text)) {
+ } else if ("!is".equals(text)) {
+ return NOT_IS;
+ } else if ("not is".equals(text)) {
+ LOG.warn("Simple operator `not is` is deprecated, use `!is` instead");
return NOT_IS;
} else if ("range".equals(text)) {
return RANGE;
- } else if ("!range".equals(text) || "not range".equals(text)) {
+ } else if ("!range".equals(text)) {
+ return NOT_RANGE;
+ } else if ("not range".equals(text)) {
+ LOG.warn("Simple operator `not range` is deprecated, use `!range` instead");
return NOT_RANGE;
- } else if ("startsWith".equals(text) || "starts with".equals(text)) {
+ } else if ("startsWith".equals(text)) {
return STARTS_WITH;
- } else if ("endsWith".equals(text) || "ends with".equals(text)) {
+ } else if ("starts with".equals(text)) {
+ LOG.warn("Simple operator `starts with` is deprecated, use `startsWith` instead");
+ return STARTS_WITH;
+ } else if ("endsWith".equals(text)) {
+ return ENDS_WITH;
+ } else if ("ends with".equals(text)) {
+ LOG.warn("Simple operator `ends with` is deprecated, use `endsWith` instead");
return ENDS_WITH;
}
throw new IllegalArgumentException("Operator not supported: " + text);
diff --git a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_18.adoc b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_18.adoc
index 8f73ede7e86b..f071203e164d 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_18.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_18.adoc
@@ -13,6 +13,18 @@ See the xref:camel-upgrade-recipes-tool.adoc[documentation] page for details.
== Upgrading Camel 4.17 to 4.18
+== camel-core
+
+=== camel-simple
+
+The *simple* language has deprecated binary operators that uses space in the name:
+
+- `not contains` use `!contains` instead
+- `not regex` use `!regex` instead
+- `not range` use `!range` instead
+- `starts with` use `startsWith` instead
+- `ends with` use `endsWith` instead
+
=== Component deprecation
The `camel-olingo2` and `camel-olingo4` component are deprecated.