You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by dh...@apache.org on 2014/06/10 21:51:31 UTC

[03/35] git commit: Made ApiMethodParser.parse() final and added processResults to avoid warnings from ApiMethodParser

Made ApiMethodParser.parse() final and added processResults to avoid warnings from ApiMethodParser


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

Branch: refs/heads/master
Commit: 7431e7e9fa9c8ce2d2477fb0a17d16a44e0255d1
Parents: 2ffeacc
Author: Dhiraj Bokde <dh...@yahoo.com>
Authored: Fri May 23 18:33:04 2014 -0700
Committer: Dhiraj Bokde <dh...@yahoo.com>
Committed: Tue Jun 10 12:48:29 2014 -0700

----------------------------------------------------------------------
 .../camel/util/component/ApiMethodParser.java   |  8 +++-
 .../component/ArgumentSubstitutionParser.java   |  4 +-
 .../apache/camel/maven/TestProxyApiMethod.java  | 48 ++++++++++++++++++++
 3 files changed, 57 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/7431e7e9/camel-core/src/main/java/org/apache/camel/util/component/ApiMethodParser.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/util/component/ApiMethodParser.java b/camel-core/src/main/java/org/apache/camel/util/component/ApiMethodParser.java
index 4c6523a..58ada5a 100644
--- a/camel-core/src/main/java/org/apache/camel/util/component/ApiMethodParser.java
+++ b/camel-core/src/main/java/org/apache/camel/util/component/ApiMethodParser.java
@@ -88,7 +88,7 @@ public abstract class ApiMethodParser<T> {
      * Parses the method signatures from {@code getSignatures()}.
      * @return list of Api methods as {@link ApiMethodModel}
      */
-    public List<ApiMethodModel> parse() {
+    public final List<ApiMethodModel> parse() {
         // parse sorted signatures and generate descriptions
         List<ApiMethodModel> result = new ArrayList<ApiMethodModel>();
         for (String signature: signatures) {
@@ -124,6 +124,8 @@ public abstract class ApiMethodParser<T> {
             result.add(new ApiMethodModel(name, resultType, arguments, method));
         }
 
+        result = processResults(result);
+
         Collections.sort(result, new Comparator<ApiMethodModel>() {
             @Override
             public int compare(ApiMethodModel model1, ApiMethodModel model2) {
@@ -171,6 +173,10 @@ public abstract class ApiMethodParser<T> {
         return result;
     }
 
+    protected List<ApiMethodModel> processResults(List<ApiMethodModel> result) {
+        return result;
+    }
+
     protected Class<?> forName(String className) {
         return forName(className, classLoader);
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/7431e7e9/camel-core/src/main/java/org/apache/camel/util/component/ArgumentSubstitutionParser.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/util/component/ArgumentSubstitutionParser.java b/camel-core/src/main/java/org/apache/camel/util/component/ArgumentSubstitutionParser.java
index 0e15833..43f60e9 100644
--- a/camel-core/src/main/java/org/apache/camel/util/component/ArgumentSubstitutionParser.java
+++ b/camel-core/src/main/java/org/apache/camel/util/component/ArgumentSubstitutionParser.java
@@ -57,10 +57,10 @@ public class ArgumentSubstitutionParser<T> extends ApiMethodParser<T> {
     }
 
     @Override
-    public List<ApiMethodModel> parse() {
+    public List<ApiMethodModel> processResults(List<ApiMethodModel> parseResult) {
         final List<ApiMethodModel> result = new ArrayList<ApiMethodModel>();
 
-        for (ApiMethodModel model : super.parse()) {
+        for (ApiMethodModel model : parseResult) {
             // look for method name matches
             for (Map.Entry<Pattern, Map<Pattern, List<NameReplacement>>> methodEntry : methodMap.entrySet()) {
                 if (methodEntry.getKey().matcher(model.getName()).matches()) {

http://git-wip-us.apache.org/repos/asf/camel/blob/7431e7e9/tooling/maven/camel-component-util-maven-plugin/src/test/java/org/apache/camel/maven/TestProxyApiMethod.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-component-util-maven-plugin/src/test/java/org/apache/camel/maven/TestProxyApiMethod.java b/tooling/maven/camel-component-util-maven-plugin/src/test/java/org/apache/camel/maven/TestProxyApiMethod.java
new file mode 100644
index 0000000..2a5bee2
--- /dev/null
+++ b/tooling/maven/camel-component-util-maven-plugin/src/test/java/org/apache/camel/maven/TestProxyApiMethod.java
@@ -0,0 +1,48 @@
+/*
+ * Camel ApiMethod Enumeration generated by camel-component-util-maven-plugin
+ * Generated on: Fri May 23 17:35:21 PDT 2014
+ */
+package org.apache.camel.maven;
+
+import java.lang.reflect.Method;
+import java.util.List;
+
+import org.apache.camel.maven.TestProxy;
+
+import org.apache.camel.util.component.ApiMethod;
+import org.apache.camel.util.component.ApiMethodImpl;
+
+/**
+ * Camel {@link ApiMethod} Enumeration for org.apache.camel.maven.TestProxy
+ */
+public enum TestProxyApiMethod implements ApiMethod {
+
+    GREETALL(java.lang.String.class, "greetAll", new java.lang.String[0].getClass(), "names"),
+    GREETALL_1(java.lang.String.class, "greetAll", java.util.List.class, "namesList"),
+    GREETME(java.lang.String.class, "greetMe", java.lang.String.class, "name"),
+    GREETTIMES(new java.lang.String[0].getClass(), "greetTimes", java.lang.String.class, "name", int.class, "times"),
+    GREETUS(java.lang.String.class, "greetUs", java.lang.String.class, "name1", java.lang.String.class, "name2"),
+    SAYHI(java.lang.String.class, "sayHi"),
+    SAYHI_1(java.lang.String.class, "sayHi", java.lang.String.class, "name");
+
+    private final ApiMethod apiMethod;
+
+    private TestProxyApiMethod(Class<?> resultType, String name, Object... args) {
+        this.apiMethod = new ApiMethodImpl(TestProxy.class, resultType, name, args);
+    }
+
+    @Override
+    public String getName() { return apiMethod.getName(); }
+
+    @Override
+    public Class<?> getResultType() { return apiMethod.getResultType(); }
+
+    @Override
+    public List<String> getArgNames() { return apiMethod.getArgNames(); }
+
+    @Override
+    public List<Class<?>> getArgTypes() { return apiMethod.getArgTypes(); }
+
+    @Override
+    public Method getMethod() { return apiMethod.getMethod(); }
+}