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 0351427a39c6dba6b13c2ade39f575dd5ebc5fa5 Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Fri Aug 16 11:41:27 2024 +0200 CAMEL-20569: camel-catalog - Markup languages which functions they support for better doc and tooling. --- .../org/apache/camel/language/simple/simple.json | 6 +++++- .../docs/modules/languages/pages/simple-language.adoc | 2 +- .../apache/camel/language/simple/SimpleConstants.java | 17 +++++++++++++++++ 3 files changed, 23 insertions(+), 2 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 ab4acc95bc3..dd3c365112d 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 @@ -61,6 +61,10 @@ "propertiesExist:key": { "index": 36, "kind": "function", "displayName": "Property Placeholder Exists", "group": "function", "label": "function", "required": false, "javaType": "boolean", "prefix": "${", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Checks whether a property placeholder with the given key exists or not. The result can be negated by prefixing the key with !", "suffix": "}" }, "properties:key:default": { "index": 37, "kind": "function", "displayName": "Property Placeholder", "group": "function", "label": "function", "required": false, "javaType": "String", "prefix": "${", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Lookup a property placeholder with the given key. If the key does not exist nor has a value, then an optional default value can be specified.", "suffix": "}" }, "ref:name": { "index": 38, "kind": "function", "displayName": "Bean By Id", "group": "function", "label": "function", "required": false, "javaType": "Object", "prefix": "${", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "To look up a bean from the Registry with the given name.", "suffix": "}" }, - "type:name.field": { "index": 39, "kind": "function", "displayName": "Java Field Value", "group": "function", "label": "function", "required": false, "javaType": "Object", "prefix": "${", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "To refer to a type or field by its classname. To refer to a field, you can append .FIELD_NAME. For example, you can refer to the constant field from Exchange as: `org.apache.camel.Exchange.FILE_NAME`", " [...] + "type:name.field": { "index": 39, "kind": "function", "displayName": "Java Field Value", "group": "function", "label": "function", "required": false, "javaType": "Object", "prefix": "${", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "To refer to a type or field by its classname. To refer to a field, you can append .FIELD_NAME. For example, you can refer to the constant field from Exchange as: `org.apache.camel.Exchange.FILE_NAME`", " [...] + "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": "}" } } } 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 6902902d223..3182c19c9a5 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 @@ -254,7 +254,7 @@ If the number is negative, then the returned string is clipped from the ending. If the number is positive, then the returned string is clipped from the beginning. If the number is negative, then the returned string is clipped from the ending. -|substring(num1,num2,exp) |String |replace all the string values in the given expression. +|substring(num1,num2,exp) |String |returns a substring of the given expression. If the number is positive, then the returned string is clipped from the beginning. If the number is negative, then the returned string is clipped from the ending. 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 e53479c2b67..6338c609571 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 @@ -156,5 +156,22 @@ public final class SimpleConstants { + " constant field from Exchange as: `org.apache.camel.Exchange.FILE_NAME`", label = "function", javaType = "Object", displayName = "Java Field Value") public static final String TYPE = "type:name.field"; + @Metadata(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 quote, and `\\∅` as empty value.", + label = "function", javaType = "String") + public static final String REPLACE = "replace(from,to,exp)"; + @Metadata(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 from the beginning." + + " Otherwise the returned string is clipped between the head and tail positions.", + label = "function", javaType = "String") + public static final String SUBSTRING = "substring(head,tail)"; + @Metadata(description = "Returns a random number between min (included) and max (excluded).", label = "function", + javaType = "int") + public static final String RANDOM = "random(min,max)"; + @Metadata(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.", + label = "function", javaType = "java.util.Iterator") + public static final String SKIP = "skip(num)"; }