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 2024/08/16 12:02:11 UTC
(camel) 09/13: CAMEL-20569: camel-catalog - Markup languages which functions they support for better doc and tooling.
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch lan-markup
in repository https://gitbox.apache.org/repos/asf/camel.git
commit f482da43d7d4498d06ce738502762ca2edfdba5c
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Aug 16 11:58:06 2024 +0200
CAMEL-20569: camel-catalog - Markup languages which functions they support for better doc and tooling.
---
.../org/apache/camel/language/simple/simple.json | 9 ++++-
.../camel/language/simple/SimpleConstants.java | 39 +++++++++++++++++++---
2 files changed, 42 insertions(+), 6 deletions(-)
diff --git a/core/camel-core-languages/src/generated/resources/META-INF/org/apache/camel/language/simple/simple.json b/core/camel-core-languages/src/generated/resources/META-INF/org/apache/camel/language/simple/simple.json
index dd3c365112d..fe3c0073ccd 100644
--- a/core/camel-core-languages/src/generated/resources/META-INF/org/apache/camel/language/simple/simple.json
+++ b/core/camel-core-languages/src/generated/resources/META-INF/org/apache/camel/language/simple/simple.json
@@ -65,6 +65,13 @@
"replace(from,to,exp)": { "index": 40, "kind": "function", "displayName": "Replace", "group": "function", "label": "function", "required": false, "javaType": "String", "prefix": "${", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Replace all the string values in the message body\/expression. To make it easier to replace single and double quotes, then you can use XML escaped values `\\"` as double quote, `\\'` as single quot [...]
"substring(head,tail)": { "index": 41, "kind": "function", "displayName": "Substring", "group": "function", "label": "function", "required": false, "javaType": "String", "prefix": "${", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Returns a substring of the message body\/expression. If only one positive number, then the returned string is clipped from the beginning. If only one negative number, then the returned string is clipped fr [...]
"random(min,max)": { "index": 42, "kind": "function", "displayName": "Random", "group": "function", "label": "function", "required": false, "javaType": "int", "prefix": "${", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Returns a random number between min (included) and max (excluded).", "suffix": "}" },
- "skip(num)": { "index": 43, "kind": "function", "displayName": "Skip", "group": "function", "label": "function", "required": false, "javaType": "java.util.Iterator", "prefix": "${", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The skip function iterates the message body and skips the first number of items. This can be used with the Splitter EIP to split a message body and skip the first N number of items.", "suffix": "}" }
+ "skip(num)": { "index": 43, "kind": "function", "displayName": "Skip", "group": "function", "label": "function", "required": false, "javaType": "java.util.Iterator", "prefix": "${", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The skip function iterates the message body and skips the first number of items. This can be used with the Splitter EIP to split a message body and skip the first N number of items.", "suffix": "}" },
+ "collate(num)": { "index": 44, "kind": "function", "displayName": "Collate", "group": "function", "label": "function", "required": false, "javaType": "java.util.Iterator", "prefix": "${", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The collate function iterates the message body and groups the data into sub lists of specified size. This can be used with the Splitter EIP to split a message body and group\/batch the split sub message [...]
+ "join(separator,prefix,exp)": { "index": 45, "kind": "function", "displayName": "Join", "group": "function", "label": "function", "required": false, "javaType": "String", "prefix": "${", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The join function iterates the message body\/expression and joins the data into a string. The separator is by default a comma. The prefix is optional. The join uses the message body as source by default. [...]
+ "messageHistory(boolean)": { "index": 46, "kind": "function", "displayName": "Message History", "group": "function", "label": "function", "required": false, "javaType": "String", "prefix": "${", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The message history of the current exchange (how it has been routed). This is similar to the route stack-trace message history the error handler logs in case of an unhandled exception. The boolean [...]
+ "uuid(type)": { "index": 47, "kind": "function", "displayName": "UUID", "group": "function", "label": "function", "required": false, "javaType": "String", "prefix": "${", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Returns a UUID using the Camel `UuidGenerator`. You can choose between `default`, `classic`, `short` and `simple` as the type. If no type is given, the default is used. It is also possible to use a custom `UuidGenerator` [...]
+ "hash(exp,algorithm)": { "index": 48, "kind": "function", "displayName": "Hash", "group": "function", "label": "function", "required": false, "javaType": "String", "prefix": "${", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Returns a hashed value (string in hex decimal) of the message body\/expression using JDK MessageDigest. The algorithm can be SHA-256 (default) or SHA3-256.", "suffix": "}" },
+ "empty(type)": { "index": 49, "kind": "function", "displayName": "Empty", "group": "function", "label": "function", "required": false, "javaType": "Object", "prefix": "${", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Creates a new empty object (decided by type). Use `string` to create an empty String. Use `list` to create an empty `java.util.ArrayList`. Use `map` to create an empty `java.util.HashMap`.", "suffix": "}" },
+ "iif(predicate,trueExp,falseExp)": { "index": 50, "kind": "function", "displayName": "Iif", "group": "function", "label": "function", "required": false, "javaType": "Object", "prefix": "${", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Evaluates the predicate and returns the value of trueExp or falseExp. This function is similar to the ternary operator in Java.", "suffix": "}" }
}
}
diff --git a/core/camel-core-languages/src/main/java/org/apache/camel/language/simple/SimpleConstants.java b/core/camel-core-languages/src/main/java/org/apache/camel/language/simple/SimpleConstants.java
index 6338c609571..558bc88b905 100644
--- a/core/camel-core-languages/src/main/java/org/apache/camel/language/simple/SimpleConstants.java
+++ b/core/camel-core-languages/src/main/java/org/apache/camel/language/simple/SimpleConstants.java
@@ -91,8 +91,7 @@ public final class SimpleConstants {
public static final String HEADER_AS = "headerAs(key,type)";
@Metadata(description = "Returns all the message headers in a Map", label = "function", javaType = "java.util.Map")
public static final String HEADERS = "headers";
- @Metadata(description = "Converts the variable to the given type (classname).", label = "function",
- javaType = "Object")
+ @Metadata(description = "Converts the variable to the given type (classname).", label = "function", javaType = "Object")
public static final String VARIABLE_AS = "variableAs(key,type)";
@Metadata(description = "Returns all the variables from the current Exchange in a Map", label = "function",
javaType = "java.util.Map")
@@ -118,8 +117,7 @@ public final class SimpleConstants {
@Metadata(description = "Converts the expression to a String, and attempts to pretty print if JSon or XML, otherwise the expression is returned as the String value.",
label = "function", javaType = "String", displayName = "Pretty Print")
public static final String PRETTY = "pretty(exp)";
- @Metadata(description = "Evaluates to a java.util.Date object."
- + " Supported commands are: `now` for current timestamp,"
+ @Metadata(description = "Evaluates to a java.util.Date object." + " Supported commands are: `now` for current timestamp,"
+ " `exchangeCreated` for the timestamp when the current exchange was created,"
+ " `header.xxx` to use the Long/Date object in the header with the key xxx."
+ " `variable.xxx` to use the Long/Date in the variable with the key xxx."
@@ -173,5 +171,36 @@ public final class SimpleConstants {
+ " This can be used with the Splitter EIP to split a message body and skip the first N number of items.",
label = "function", javaType = "java.util.Iterator")
public static final String SKIP = "skip(num)";
-
+ @Metadata(description = "The collate function iterates the message body and groups the data into sub lists of specified size."
+ + " This can be used with the Splitter EIP to split a message body and group/batch"
+ + " the split sub message into a group of N sub lists.",
+ label = "function", javaType = "java.util.Iterator")
+ public static final String COLLATE = "collate(num)";
+ @Metadata(description = "The join function iterates the message body/expression and joins the data into a string."
+ + " The separator is by default a comma. The prefix is optional."
+ + " The join uses the message body as source by default. It is possible to refer to another"
+ + " source (simple language) such as a header via the exp parameter. For example `join('&','id=','$\\{header.ids}')`.",
+ label = "function", javaType = "String")
+ public static final String JOIN = "join(separator,prefix,exp)";
+ @Metadata(description = "The message history of the current exchange (how it has been routed). This is similar to the route stack-trace message history"
+ + " the error handler logs in case of an unhandled exception."
+ + " The boolean can be used to turn off detailed information to be less verbose, and avoid printing sensitive data from the message.",
+ label = "function", javaType = "String")
+ public static final String MESSAGE_HISTORY = "messageHistory(boolean)";
+ @Metadata(description = "Returns a UUID using the Camel `UuidGenerator`."
+ + " You can choose between `default`, `classic`, `short` and `simple` as the type."
+ + " If no type is given, the default is used. It is also possible to use a custom `UuidGenerator`"
+ + " and bind the bean to the xref:manual::registry.adoc[Registry] with an id. For example `${uuid(myGenerator)}`"
+ + " where the ID is _myGenerator_.",
+ label = "function", javaType = "String", displayName = "UUID")
+ public static final String UUID = "uuid(type)";
+ @Metadata(description = "Returns a hashed value (string in hex decimal) of the message body/expression using JDK MessageDigest. The algorithm can be SHA-256 (default) or SHA3-256.",
+ label = "function", javaType = "String")
+ public static final String HASH = "hash(exp,algorithm)";
+ @Metadata(description = "Creates a new empty object (decided by type). Use `string` to create an empty String. Use `list` to create an empty `java.util.ArrayList`. Use `map` to create an empty `java.util.HashMap`.",
+ label = "function", javaType = "Object")
+ public static final String EMPTY = "empty(type)";
+ @Metadata(description = "Evaluates the predicate and returns the value of trueExp or falseExp. This function is similar to the ternary operator in Java.",
+ label = "function", javaType = "Object")
+ public static final String IIF = "iif(predicate,trueExp,falseExp)";
}