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 2023/04/01 07:29:06 UTC

[camel] branch main updated: CAMEL-19233: changed code generation for ApiCollection (#9745)

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

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new 405554154cd CAMEL-19233: changed code generation for <component>ApiCollection (#9745)
405554154cd is described below

commit 405554154cd75f450de6235b574829aba1cdb724
Author: dk2k <dk...@users.noreply.github.com>
AuthorDate: Sat Apr 1 10:29:00 2023 +0300

    CAMEL-19233: changed code generation for <component>ApiCollection (#9745)
    
    Co-authored-by: dk2k <dk...@ya.ru>
---
 .../src/main/resources/api-collection.vm                          | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tooling/maven/camel-api-component-maven-plugin/src/main/resources/api-collection.vm b/tooling/maven/camel-api-component-maven-plugin/src/main/resources/api-collection.vm
index 8c3312c6b88..fb621549707 100644
--- a/tooling/maven/camel-api-component-maven-plugin/src/main/resources/api-collection.vm
+++ b/tooling/maven/camel-api-component-maven-plugin/src/main/resources/api-collection.vm
@@ -37,10 +37,10 @@
 package $packageName;
 
 import java.util.Arrays;
+import java.util.EnumMap;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.HashMap;
 
 #set( $componentConfig = "${componentName}Configuration" )
 import ${componentPackage}.${componentConfig};
@@ -60,8 +60,8 @@ public final class $collectionName extends ApiCollection<${apiNameEnum}, ${compo
     private static $collectionName collection;
 
     private ${collectionName}() {
-        final Map<String, String> aliases = new HashMap<String, String>();
-        final Map<${apiNameEnum}, ApiMethodHelper<? extends ApiMethod>> apiHelpers = new HashMap<>();
+        final Map<String, String> aliases = new HashMap<>();
+        final Map<${apiNameEnum}, ApiMethodHelper<? extends ApiMethod>> apiHelpers = new EnumMap<>(${apiNameEnum}.class);
         final Map<Class<? extends ApiMethod>, ${apiNameEnum}> apiMethods = new HashMap<>();
 
         List<String> nullableArgs;
@@ -74,7 +74,7 @@ public final class $collectionName extends ApiCollection<${apiNameEnum}, ${compo
 #set( $apiMethod = ${helper.getApiMethod($api.ProxyClass, $api.ClassPrefix)} )
 #set( $apiName = "${apiNameEnum}.${helper.getEnumConstant($api.ApiName)}" )
         nullableArgs = Arrays.asList(${helper.getNullableOptionValues($api.NullableOptions)});
-        apiHelpers.put($apiName, new ApiMethodHelper<$apiMethod>(${apiMethod}.class, aliases, nullableArgs));
+        apiHelpers.put($apiName, new ApiMethodHelper<>(${apiMethod}.class, aliases, nullableArgs));
         apiMethods.put(${apiMethod}.class, ${apiName});
 #end