You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by gn...@apache.org on 2019/06/06 07:04:54 UTC

[camel] 01/05: Use wrapper types for primitives to later be able to differentiate values that have not been set

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

gnodet pushed a commit to branch endpoint-dsl
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 18d99d2a2452a7bd8b5c5c04a8abeae7605758f2
Author: Guillaume Nodet <gn...@gmail.com>
AuthorDate: Wed Jun 5 23:36:21 2019 +0200

    Use wrapper types for primitives to later be able to differentiate values that have not been set
---
 .../org/apache/camel/maven/packaging/EndpointDslMojo.java | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/EndpointDslMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/EndpointDslMojo.java
index c6730e1..11155cb 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/EndpointDslMojo.java
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/EndpointDslMojo.java
@@ -79,7 +79,6 @@ import static org.apache.camel.maven.packaging.PackageHelper.loadText;
 public class EndpointDslMojo extends AbstractMojo {
 
     private static final Map<String, String> PRIMITIVEMAP;
-    private static final Map<String, Class> PRIMITIVE_CLASSES = new HashMap<>();
 
     static {
         PRIMITIVEMAP = new HashMap<>();
@@ -92,16 +91,6 @@ public class EndpointDslMojo extends AbstractMojo {
         PRIMITIVEMAP.put("short", "java.lang.Short");
         PRIMITIVEMAP.put("double", "java.lang.Double");
         PRIMITIVEMAP.put("float", "java.lang.Float");
-
-        PRIMITIVE_CLASSES.put("int", int.class);
-        PRIMITIVE_CLASSES.put("short", short.class);
-        PRIMITIVE_CLASSES.put("long", long.class);
-        PRIMITIVE_CLASSES.put("byte", byte.class);
-        PRIMITIVE_CLASSES.put("char", char.class);
-        PRIMITIVE_CLASSES.put("float", float.class);
-        PRIMITIVE_CLASSES.put("double", double.class);
-        PRIMITIVE_CLASSES.put("boolean", boolean.class);
-        PRIMITIVE_CLASSES.put("void", void.class);
     }
 
     private static final String[] IGNORE_MODULES = {/* Non-standard -> */ };
@@ -333,7 +322,7 @@ public class EndpointDslMojo extends AbstractMojo {
     }
 
     static boolean isPrimitive(String type) {
-        return PRIMITIVE_CLASSES.containsKey(type);
+        return PRIMITIVEMAP.containsKey(type);
     }
 
     private Class<?> loadClass(String loadClassName) {
@@ -382,7 +371,7 @@ public class EndpointDslMojo extends AbstractMojo {
         }
         // Primitive
         if (isPrimitive(type)) {
-            return new GenericType(PRIMITIVE_CLASSES.get(type));
+            return new GenericType(loadClass(PRIMITIVEMAP.get(type)));
         }
         // Extends
         if (type.startsWith("? extends ")) {