camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [1/3] camel git commit: Component docs - Allow to explict specify javaType of UriPath/UriParam property to specify the preferred type to use
Date Sun, 03 Jan 2016 10:51:49 GMT
Repository: camel
Updated Branches:
  refs/heads/camel-2.16.x 0cdce29ab -> 367eb6573
  refs/heads/master ef9e179a5 -> 1e5bc2487


Component docs - Allow to explict specify javaType of UriPath/UriParam property to specify
the preferred type to use


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

Branch: refs/heads/master
Commit: 1e5bc2487cd83661ec2e7d6640bdd0706ad1fe21
Parents: ef9e179
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Sun Jan 3 11:48:38 2016 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Sun Jan 3 11:48:38 2016 +0100

----------------------------------------------------------------------
 .../camel/component/file/GenericFileEndpoint.java  | 17 +++++++++--------
 .../tools/apt/EndpointAnnotationProcessor.java     |  9 +++++++++
 .../main/java/org/apache/camel/spi/UriParam.java   |  7 +++++++
 .../main/java/org/apache/camel/spi/UriPath.java    |  7 +++++++
 4 files changed, 32 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/1e5bc248/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java
b/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java
index 160fc9f..52d2af1 100644
--- a/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java
+++ b/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java
@@ -42,6 +42,7 @@ import org.apache.camel.spi.ExceptionHandler;
 import org.apache.camel.spi.FactoryFinder;
 import org.apache.camel.spi.IdempotentRepository;
 import org.apache.camel.spi.Language;
+import org.apache.camel.spi.Metadata;
 import org.apache.camel.spi.UriParam;
 import org.apache.camel.util.FileUtil;
 import org.apache.camel.util.IOHelper;
@@ -73,7 +74,7 @@ public abstract class GenericFileEndpoint<T> extends ScheduledPollEndpoint
imple
     protected int bufferSize = FileUtil.BUFFER_SIZE;
     @UriParam
     protected String charset;
-    @UriParam
+    @UriParam(javaType = "java.lang.String")
     protected Expression fileName;
 
     // producer options
@@ -84,7 +85,7 @@ public abstract class GenericFileEndpoint<T> extends ScheduledPollEndpoint
imple
     protected GenericFileExist fileExist = GenericFileExist.Override;
     @UriParam(label = "producer")
     protected String tempPrefix;
-    @UriParam(label = "producer")
+    @UriParam(label = "producer", javaType = "java.lang.String")
     protected Expression tempFileName;
     @UriParam(label = "producer,advanced", defaultValue = "true")
     protected boolean eagerDeleteTargetFile = true;
@@ -129,17 +130,17 @@ public abstract class GenericFileEndpoint<T> extends ScheduledPollEndpoint
imple
     protected String include;
     @UriParam(label = "consumer,filter")
     protected String exclude;
-    @UriParam(label = "consumer,filter")
+    @UriParam(label = "consumer,filter", javaType = "java.lang.String")
     protected Expression move;
-    @UriParam(label = "consumer")
+    @UriParam(label = "consumer", javaType = "java.lang.String")
     protected Expression moveFailed;
-    @UriParam(label = "consumer")
+    @UriParam(label = "consumer", javaType = "java.lang.String")
     protected Expression preMove;
-    @UriParam(label = "producer")
+    @UriParam(label = "producer", javaType = "java.lang.String")
     protected Expression moveExisting;
     @UriParam(label = "consumer,filter", defaultValue = "false")
     protected Boolean idempotent;
-    @UriParam(label = "consumer,filter")
+    @UriParam(label = "consumer,filter", javaType = "java.lang.String")
     protected Expression idempotentKey;
     @UriParam(label = "consumer,filter")
     protected IdempotentRepository<String> idempotentRepository;
@@ -154,7 +155,7 @@ public abstract class GenericFileEndpoint<T> extends ScheduledPollEndpoint
imple
     protected String antExclude;
     @UriParam(label = "consumer,sort")
     protected Comparator<GenericFile<T>> sorter;
-    @UriParam(label = "consumer,sort")
+    @UriParam(label = "consumer,sort", javaType = "java.lang.String")
     protected Comparator<Exchange> sortBy;
     @UriParam(label = "consumer,sort")
     protected boolean shuffle;

http://git-wip-us.apache.org/repos/asf/camel/blob/1e5bc248/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 1f4025a..fc55db8 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
@@ -646,6 +646,11 @@ public class EndpointAnnotationProcessor extends AbstractAnnotationProcessor
{
                         }
                     }
 
+                    // the field type may be overloaded by another type
+                    if (!Strings.isNullOrEmpty(path.javaType())) {
+                        fieldTypeName = path.javaType();
+                    }
+
                     String group = EndpointHelper.labelAsGroupName(label, componentModel.isConsumerOnly(),
componentModel.isProducerOnly());
                     EndpointPath ep = new EndpointPath(name, fieldTypeName, required, defaultValue,
docComment, deprecated, group, label, isEnum, enums);
                     endpointPaths.add(ep);
@@ -717,6 +722,10 @@ public class EndpointAnnotationProcessor extends AbstractAnnotationProcessor
{
                             }
                         }
 
+                        // the field type may be overloaded by another type
+                        if (!Strings.isNullOrEmpty(param.javaType())) {
+                            fieldTypeName = param.javaType();
+                        }
 
                         String group = EndpointHelper.labelAsGroupName(label, componentModel.isConsumerOnly(),
componentModel.isProducerOnly());
                         EndpointOption option = new EndpointOption(name, fieldTypeName, required,
defaultValue, defaultValueNote,

http://git-wip-us.apache.org/repos/asf/camel/blob/1e5bc248/tooling/spi-annotations/src/main/java/org/apache/camel/spi/UriParam.java
----------------------------------------------------------------------
diff --git a/tooling/spi-annotations/src/main/java/org/apache/camel/spi/UriParam.java b/tooling/spi-annotations/src/main/java/org/apache/camel/spi/UriParam.java
index 13e067d..59e4bcd 100644
--- a/tooling/spi-annotations/src/main/java/org/apache/camel/spi/UriParam.java
+++ b/tooling/spi-annotations/src/main/java/org/apache/camel/spi/UriParam.java
@@ -77,4 +77,11 @@ public @interface UriParam {
      */
     String label() default "";
 
+    /**
+     * To re-associate the preferred Java type of this parameter.
+     * <p/>
+     * This is used for parameters which are of a specialized type but can be configured
by another Java type, such as from a String.
+     */
+    String javaType() default "";
+
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/1e5bc248/tooling/spi-annotations/src/main/java/org/apache/camel/spi/UriPath.java
----------------------------------------------------------------------
diff --git a/tooling/spi-annotations/src/main/java/org/apache/camel/spi/UriPath.java b/tooling/spi-annotations/src/main/java/org/apache/camel/spi/UriPath.java
index 8432509..23dac1f 100644
--- a/tooling/spi-annotations/src/main/java/org/apache/camel/spi/UriPath.java
+++ b/tooling/spi-annotations/src/main/java/org/apache/camel/spi/UriPath.java
@@ -79,4 +79,11 @@ public @interface UriPath {
      */
     String label() default "";
 
+    /**
+     * To re-associate the preferred Java type of this parameter.
+     * <p/>
+     * This is used for parameters which are of a specialized type but can be configured
by another Java type, such as from a String.
+     */
+    String javaType() default "";
+
 }
\ No newline at end of file


Mime
View raw message