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

[camel] 01/04: CAMEL-15478: API parameters that have java types in generics should be preserved.

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 d8ffccb6d563e9b74c389e65db1fb0b3b5f3f79f
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Wed Sep 16 07:03:07 2020 +0200

    CAMEL-15478: API parameters that have java types in generics should be preserved.
---
 .../camel/component/twilio/MessageEndpointConfiguration.java     | 6 +++---
 .../component/twilio/MessageEndpointConfigurationConfigurer.java | 9 +++++++++
 .../src/main/java/org/apache/camel/maven/JavaSourceParser.java   | 6 +++++-
 3 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/components/camel-twilio/src/generated/java/org/apache/camel/component/twilio/MessageEndpointConfiguration.java b/components/camel-twilio/src/generated/java/org/apache/camel/component/twilio/MessageEndpointConfiguration.java
index f3f6913..1edb881 100644
--- a/components/camel-twilio/src/generated/java/org/apache/camel/component/twilio/MessageEndpointConfiguration.java
+++ b/components/camel-twilio/src/generated/java/org/apache/camel/component/twilio/MessageEndpointConfiguration.java
@@ -27,7 +27,7 @@ public final class MessageEndpointConfiguration extends TwilioConfiguration {
     private com.twilio.type.PhoneNumber from;
     @UriParam
     @ApiParam(apiMethods = {@ApiMethod(methodName = "creator", description="The URL of the media to send with the message")})
-    private java.util.List mediaUrl;
+    private java.util.List<java.net.URI> mediaUrl;
     @UriParam
     @ApiParam(apiMethods = {@ApiMethod(methodName = "creator", description="The SID of the Messaging Service you want to associate with the message")})
     private String messagingServiceSid;
@@ -57,11 +57,11 @@ public final class MessageEndpointConfiguration extends TwilioConfiguration {
         this.from = from;
     }
 
-    public java.util.List getMediaUrl() {
+    public java.util.List<java.net.URI> getMediaUrl() {
         return mediaUrl;
     }
 
-    public void setMediaUrl(java.util.List mediaUrl) {
+    public void setMediaUrl(java.util.List<java.net.URI> mediaUrl) {
         this.mediaUrl = mediaUrl;
     }
 
diff --git a/components/camel-twilio/src/generated/java/org/apache/camel/component/twilio/MessageEndpointConfigurationConfigurer.java b/components/camel-twilio/src/generated/java/org/apache/camel/component/twilio/MessageEndpointConfigurationConfigurer.java
index 4453075..583978a 100644
--- a/components/camel-twilio/src/generated/java/org/apache/camel/component/twilio/MessageEndpointConfigurationConfigurer.java
+++ b/components/camel-twilio/src/generated/java/org/apache/camel/component/twilio/MessageEndpointConfigurationConfigurer.java
@@ -81,5 +81,14 @@ public class MessageEndpointConfigurationConfigurer extends org.apache.camel.sup
         default: return null;
         }
     }
+
+    @Override
+    public Object getCollectionValueType(Object target, String name, boolean ignoreCase) {
+        switch (ignoreCase ? name.toLowerCase() : name) {
+        case "mediaurl":
+        case "MediaUrl": return java.net.URI.class;
+        default: return null;
+        }
+    }
 }
 
diff --git a/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/JavaSourceParser.java b/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/JavaSourceParser.java
index 8268a56..60286b0 100644
--- a/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/JavaSourceParser.java
+++ b/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/JavaSourceParser.java
@@ -143,8 +143,12 @@ public class JavaSourceParser {
                     }
                     if (!bounds && !found) {
                         // argh this is getting complex, it may be T or just java.lang.String but this **** generics and roaster
-                        // does not make this easy, so let see if we can resolve each type variable
+                        // does not make this easy, so let see if we can find out if all the types are a qualified type or only a variable
                         boolean fqn = types.stream().allMatch(t -> {
+                            // if its from java itself then its okay
+                            if (t.getQualifiedName().startsWith("java")) {
+                                return true;
+                            }
                             // okay lets assume its a type variable if the name is upper case only
                             boolean upperOnly = isUpperCaseOnly(t.getName());
                             return !upperOnly && t.getQualifiedName().indexOf('.') != -1;