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 18931a613660f18b0dbe098d2411b92b2f0a715e Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Tue Sep 15 11:57:01 2020 +0200 CAMEL-15478: api-component should generate @ApiParam with more fine grained details so we know which parameter is for which api method. --- .../component/olingo2/Olingo2AppEndpointConfiguration.java | 12 ++++++------ .../component/zendesk/ZendeskEndpointConfiguration.java | 12 ++++++------ .../main/java/org/apache/camel/maven/JavaSourceParser.java | 12 ++++++++++++ 3 files changed, 24 insertions(+), 12 deletions(-) diff --git a/components/camel-olingo2/camel-olingo2-component/src/generated/java/org/apache/camel/component/olingo2/Olingo2AppEndpointConfiguration.java b/components/camel-olingo2/camel-olingo2-component/src/generated/java/org/apache/camel/component/olingo2/Olingo2AppEndpointConfiguration.java index 2fafe20..b376ddc 100644 --- a/components/camel-olingo2/camel-olingo2-component/src/generated/java/org/apache/camel/component/olingo2/Olingo2AppEndpointConfiguration.java +++ b/components/camel-olingo2/camel-olingo2-component/src/generated/java/org/apache/camel/component/olingo2/Olingo2AppEndpointConfiguration.java @@ -27,13 +27,13 @@ public final class Olingo2AppEndpointConfiguration extends Olingo2Configuration private org.apache.olingo.odata2.api.edm.Edm edm; @UriParam @ApiParam(apiMethods = {@ApiMethod(methodName = "batch", description="HTTP Headers to add/override the component versions"), @ApiMethod(methodName = "create", description="HTTP Headers to add/override the component versions"), @ApiMethod(methodName = "delete", description="HTTP Headers to add/override the component versions"), @ApiMethod(methodName = "merge", description="HTTP Headers to add/override the component versions"), @ApiMethod(methodName = "patch", description="HTTP Headers [...] - private java.util.Map<java.lang.String, java.lang.String> endpointHttpHeaders; + private java.util.Map<String, String> endpointHttpHeaders; @UriParam @ApiParam(apiMethods = {@ApiMethod(methodName = "batch", description="OData Key predicate"), @ApiMethod(methodName = "create", description="OData Key predicate"), @ApiMethod(methodName = "delete", description="OData Key predicate"), @ApiMethod(methodName = "merge", description="OData Key predicate"), @ApiMethod(methodName = "patch", description="OData Key predicate"), @ApiMethod(methodName = "read", description="OData Key predicate"), @ApiMethod(methodName = "update", description="OD [...] private java.lang.String keyPredicate; @UriParam @ApiParam(apiMethods = {@ApiMethod(methodName = "batch", description="OData query params from http://www.odata.org/documentation/odata-version-2-0/uri-conventions#SystemQueryOptions"), @ApiMethod(methodName = "create", description="OData query params from http://www.odata.org/documentation/odata-version-2-0/uri-conventions#SystemQueryOptions"), @ApiMethod(methodName = "delete", description="OData query params from http://www.odata.org/documentation/odata-version-2-0/uri-conventions#S [...] - private java.util.Map<java.lang.String, java.lang.String> queryParams; + private java.util.Map<String, String> queryParams; @UriParam @ApiParam(apiMethods = {@ApiMethod(methodName = "batch", description="Resource path to create"), @ApiMethod(methodName = "create", description="Resource path to create"), @ApiMethod(methodName = "delete", description="Resource path for Entry"), @ApiMethod(methodName = "merge", description="Resource path to update"), @ApiMethod(methodName = "patch", description="Resource path to update"), @ApiMethod(methodName = "read", description="OData Resource path"), @ApiMethod(methodName = "upda [...] private String resourcePath; @@ -57,11 +57,11 @@ public final class Olingo2AppEndpointConfiguration extends Olingo2Configuration this.edm = edm; } - public java.util.Map<java.lang.String, java.lang.String> getEndpointHttpHeaders() { + public java.util.Map<String, String> getEndpointHttpHeaders() { return endpointHttpHeaders; } - public void setEndpointHttpHeaders(java.util.Map<java.lang.String, java.lang.String> endpointHttpHeaders) { + public void setEndpointHttpHeaders(java.util.Map<String, String> endpointHttpHeaders) { this.endpointHttpHeaders = endpointHttpHeaders; } @@ -73,11 +73,11 @@ public final class Olingo2AppEndpointConfiguration extends Olingo2Configuration this.keyPredicate = keyPredicate; } - public java.util.Map<java.lang.String, java.lang.String> getQueryParams() { + public java.util.Map<String, String> getQueryParams() { return queryParams; } - public void setQueryParams(java.util.Map<java.lang.String, java.lang.String> queryParams) { + public void setQueryParams(java.util.Map<String, String> queryParams) { this.queryParams = queryParams; } diff --git a/components/camel-zendesk/src/generated/java/org/apache/camel/component/zendesk/ZendeskEndpointConfiguration.java b/components/camel-zendesk/src/generated/java/org/apache/camel/component/zendesk/ZendeskEndpointConfiguration.java index 1dc03bc..d8d7adc 100644 --- a/components/camel-zendesk/src/generated/java/org/apache/camel/component/zendesk/ZendeskEndpointConfiguration.java +++ b/components/camel-zendesk/src/generated/java/org/apache/camel/component/zendesk/ZendeskEndpointConfiguration.java @@ -210,7 +210,7 @@ public final class ZendeskEndpointConfiguration extends ZendeskConfiguration { private String parameters; @UriParam @ApiParam(apiMethods = {@ApiMethod(methodName = "addTagToOrganisations"), @ApiMethod(methodName = "addTagToTicket"), @ApiMethod(methodName = "addTagToTopics"), @ApiMethod(methodName = "associateAttachmentsToArticle"), @ApiMethod(methodName = "changeUserPassword"), @ApiMethod(methodName = "createArticle"), @ApiMethod(methodName = "createArticle"), @ApiMethod(methodName = "createArticleTranslation"), @ApiMethod(methodName = "createAutomation"), @ApiMethod(methodName = "createCategory") [...] - private java.util.Map<String,Object> params; + private java.util.Map<String, Object> params; @UriParam @ApiParam(apiMethods = {@ApiMethod(methodName = "addTagToOrganisations"), @ApiMethod(methodName = "addTagToTicket"), @ApiMethod(methodName = "addTagToTopics"), @ApiMethod(methodName = "associateAttachmentsToArticle"), @ApiMethod(methodName = "changeUserPassword"), @ApiMethod(methodName = "createArticle"), @ApiMethod(methodName = "createArticle"), @ApiMethod(methodName = "createArticleTranslation"), @ApiMethod(methodName = "createAutomation"), @ApiMethod(methodName = "createCategory") [...] private String password; @@ -324,7 +324,7 @@ public final class ZendeskEndpointConfiguration extends ZendeskConfiguration { private Long tweetId; @UriParam @ApiParam(apiMethods = {@ApiMethod(methodName = "addTagToOrganisations"), @ApiMethod(methodName = "addTagToTicket"), @ApiMethod(methodName = "addTagToTopics"), @ApiMethod(methodName = "associateAttachmentsToArticle"), @ApiMethod(methodName = "changeUserPassword"), @ApiMethod(methodName = "createArticle"), @ApiMethod(methodName = "createArticle"), @ApiMethod(methodName = "createArticleTranslation"), @ApiMethod(methodName = "createAutomation"), @ApiMethod(methodName = "createCategory") [...] - private Class<?> type; + private Class type; @UriParam @ApiParam(apiMethods = {@ApiMethod(methodName = "addTagToOrganisations"), @ApiMethod(methodName = "addTagToTicket"), @ApiMethod(methodName = "addTagToTopics"), @ApiMethod(methodName = "associateAttachmentsToArticle"), @ApiMethod(methodName = "changeUserPassword"), @ApiMethod(methodName = "createArticle"), @ApiMethod(methodName = "createArticle"), @ApiMethod(methodName = "createArticleTranslation"), @ApiMethod(methodName = "createAutomation"), @ApiMethod(methodName = "createCategory") [...] private Long unixEpochTime; @@ -869,11 +869,11 @@ public final class ZendeskEndpointConfiguration extends ZendeskConfiguration { this.parameters = parameters; } - public java.util.Map<String,Object> getParams() { + public java.util.Map<String, Object> getParams() { return params; } - public void setParams(java.util.Map<String,Object> params) { + public void setParams(java.util.Map<String, Object> params) { this.params = params; } @@ -1173,11 +1173,11 @@ public final class ZendeskEndpointConfiguration extends ZendeskConfiguration { this.tweetId = tweetId; } - public Class<?> getType() { + public Class getType() { return type; } - public void setType(Class<?> type) { + public void setType(Class type) { this.type = type; } 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 8d82d4c..50530a7 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 @@ -128,6 +128,18 @@ public class JavaSourceParser { // the old way with javadoc did not use varargs in the signature, so lets transform this to an array style type = type + "[]"; } + if (ps.getType().isParameterized()) { + // for parameterized types then it can get complex if they are variables (T, T extends Foo etc) + List<Type> types = ps.getType().getTypeArguments(); + boolean hasTypeVariables = false; + for (Type t : types) { + hasTypeVariables |= ms.hasTypeVariable(t.getName()) || clazz.hasTypeVariable(t.getName()); + } + if (hasTypeVariables) { + // okay this gets to complex then remove the generics + type = ps.getType().getQualifiedName(); + } + } // remove java.lang. prefix as it should not be there type = type.replaceAll("java.lang.", "");