camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [10/11] camel git commit: CAMEL-8320: Component doc to include endpoint syntax.
Date Sun, 01 Mar 2015 07:42:37 GMT
CAMEL-8320: Component doc to include endpoint syntax.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/00e70956
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/00e70956
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/00e70956

Branch: refs/heads/master
Commit: 00e70956bb67d83fab3cf0b2053cc7e15ec29307
Parents: 1436a8e
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Sun Mar 1 08:37:18 2015 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Sun Mar 1 08:37:18 2015 +0100

----------------------------------------------------------------------
 .../org/apache/camel/util/ObjectHelper.java     | 22 ++++++++++++++++++++
 .../tools/apt/EndpointAnnotationProcessor.java  |  6 +++++-
 .../org/apache/camel/tools/apt/Strings.java     | 14 +++++++++++++
 3 files changed, 41 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/00e70956/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java b/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java
index edcf519..6d03134 100644
--- a/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java
+++ b/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java
@@ -426,6 +426,13 @@ public final class ObjectHelper {
         return answer;
     }
 
+    /**
+     * Returns the string after the given token
+     *
+     * @param text  the text
+     * @param after the token
+     * @return the text after the token, or <tt>null</tt> if text does not contain
the token
+     */
     public static String after(String text, String after) {
         if (!text.contains(after)) {
             return null;
@@ -433,6 +440,13 @@ public final class ObjectHelper {
         return text.substring(text.indexOf(after) + after.length());
     }
 
+    /**
+     * Returns the string before the given token
+     *
+     * @param text  the text
+     * @param before the token
+     * @return the text before the token, or <tt>null</tt> if text does not contain
the token
+     */
     public static String before(String text, String before) {
         if (!text.contains(before)) {
             return null;
@@ -440,6 +454,14 @@ public final class ObjectHelper {
         return text.substring(0, text.indexOf(before));
     }
 
+    /**
+     * Returns the string between the given tokens
+     *
+     * @param text  the text
+     * @param after the before token
+     * @param before the after token
+     * @return the text between the tokens, or <tt>null</tt> if text does not
contain the tokens
+     */
     public static String between(String text, String after, String before) {
         text = after(text, after);
         if (text == null) {

http://git-wip-us.apache.org/repos/asf/camel/blob/00e70956/tooling/apt/src/main/java/org/apache/camel/tools/apt/EndpointAnnotationProcessor.java
----------------------------------------------------------------------
diff --git a/tooling/apt/src/main/java/org/apache/camel/tools/apt/EndpointAnnotationProcessor.java
b/tooling/apt/src/main/java/org/apache/camel/tools/apt/EndpointAnnotationProcessor.java
index f9f2e0f..cf9c3fd 100644
--- a/tooling/apt/src/main/java/org/apache/camel/tools/apt/EndpointAnnotationProcessor.java
+++ b/tooling/apt/src/main/java/org/apache/camel/tools/apt/EndpointAnnotationProcessor.java
@@ -331,7 +331,11 @@ public class EndpointAnnotationProcessor extends AbstractAnnotationProcessor
{
 
     protected ComponentModel findComponentProperties(RoundEnvironment roundEnv, UriEndpoint
uriEndpoint, String scheme, String label) {
         ComponentModel model = new ComponentModel(scheme);
-        model.setSyntax(uriEndpoint.syntax());
+
+        // if the scheme is an alias then replace the scheme name from the syntax with the
alias
+        String syntax = scheme + ":" + Strings.after(uriEndpoint.syntax(), ":");
+
+        model.setSyntax(syntax);
         model.setLabel(label);
         model.setConsumerOnly(uriEndpoint.consumerOnly());
         model.setProducerOnly(uriEndpoint.producerOnly());

http://git-wip-us.apache.org/repos/asf/camel/blob/00e70956/tooling/apt/src/main/java/org/apache/camel/tools/apt/Strings.java
----------------------------------------------------------------------
diff --git a/tooling/apt/src/main/java/org/apache/camel/tools/apt/Strings.java b/tooling/apt/src/main/java/org/apache/camel/tools/apt/Strings.java
index 6fee17e..3e0747b 100644
--- a/tooling/apt/src/main/java/org/apache/camel/tools/apt/Strings.java
+++ b/tooling/apt/src/main/java/org/apache/camel/tools/apt/Strings.java
@@ -48,6 +48,20 @@ final class Strings {
     }
 
     /**
+     * Returns the string after the given token
+     *
+     * @param text  the text
+     * @param after the token
+     * @return the text after the token, or <tt>null</tt> if text does not contain
the token
+     */
+    public static String after(String text, String after) {
+        if (!text.contains(after)) {
+            return null;
+        }
+        return text.substring(text.indexOf(after) + after.length());
+    }
+
+    /**
      * Returns the canonical class name by removing any generic type information.
      */
     public static String canonicalClassName(String className) {


Mime
View raw message