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/17 13:01:07 UTC

[camel] 02/04: CAMEL-15478: Docs include method table

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch api
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 8bb54a5f5c20923977384a9470396cd7c00d5ad4
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Sep 17 13:11:42 2020 +0200

    CAMEL-15478: Docs include method table
---
 .../java/org/apache/camel/maven/packaging/MvelHelper.java |  8 ++++----
 .../src/main/resources/endpoint-options.mvel              | 15 +++++++++++----
 2 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/MvelHelper.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/MvelHelper.java
index a7a76e1..7acddcb 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/MvelHelper.java
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/MvelHelper.java
@@ -52,7 +52,7 @@ public final class MvelHelper {
         return signature + ";";
     }
 
-    public static String apiMethodNameWithAlias(ApiModel api, ApiMethodModel method) {
+    public static String apiMethodAlias(ApiModel api, ApiMethodModel method) {
         String name = method.getName();
         for (String alias : api.getAliases()) {
             int pos = alias.indexOf('=');
@@ -60,10 +60,10 @@ public final class MvelHelper {
             String aliasMethod = alias.substring(pos + 1);
             // match ignore case
             if (Pattern.compile(pattern, Pattern.CASE_INSENSITIVE).matcher(name).matches()) {
-                name += " + \n " + aliasMethod;
-                break;
+                return aliasMethod;
             }
         }
-        return name;
+        // empty if no alias
+        return "";
     }
 }
diff --git a/tooling/maven/camel-package-maven-plugin/src/main/resources/endpoint-options.mvel b/tooling/maven/camel-package-maven-plugin/src/main/resources/endpoint-options.mvel
index 444200d..e597cea 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/resources/endpoint-options.mvel
+++ b/tooling/maven/camel-package-maven-plugin/src/main/resources/endpoint-options.mvel
@@ -59,13 +59,20 @@ The @{api.name} API has @{api.methods.size} method(s) which is represented by th
 @end{}@end{}
 ----
 
-API methods can have a shorthand alias name which can be used in the syntax instead of the name.
+The @{api.methods.size} method(s) is listed in the table below.
+(API methods can have a shorthand alias name which can be used in the syntax instead of the name)
 
-The API methods has the following set of options listed in the following table:
+[width="100%",cols="2,2,6",options="header"]
+|===@comment{ Render table cells. If description contains newline, prefix cell with `a`, so the content is rendered with formatting. }
+| Method | Alias | Description
+@foreach{method : api.methods}| *@{method.name}* | @{util.apiMethodAlias(api, method)} | @{method.description}
+@end{}|===
+
+The API methods has the following set of options listed in the table below:
 [width="100%",cols="2,2,4,2",options="header"]
 |===@comment{ Render table cells. If description contains newline, prefix cell with `a`, so the content is rendered with formatting. }
-| Method / Alias | Name | Description | Type
-@foreach{method : api.methods}@foreach{row : method.options}| @{util.apiMethodNameWithAlias(api, method)} | *@{row.getShortName(30)}* @{row.description.?contains("\n") ? "a" : ""}| @{util.escape(row.description)} | @{row.getShortJavaType()}
+| Method | Name | Description | Type
+@foreach{method : api.methods}@foreach{row : method.options}| @{method.name} | *@{row.getShortName(30)}* @{row.description.?contains("\n") ? "a" : ""}| @{util.escape(row.description)} | @{row.getShortJavaType()}
 @end{}@end{}|===