
mel.camel-api-component-maven-plugin.2.18.0.source-code.api-collection.vm Maven / Gradle / Ivy
## ------------------------------------------------------------------------
## Licensed to the Apache Software Foundation (ASF) under one or more
## contributor license agreements. See the NOTICE file distributed with
## this work for additional information regarding copyright ownership.
## The ASF licenses this file to You under the Apache License, Version 2.0
## (the "License"); you may not use this file except in compliance with
## the License. You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
## ------------------------------------------------------------------------
## api-collection.vm
/*
* Camel ApiCollection generated by camel-api-component-maven-plugin
* Generated on: $generatedDate
*/
package $packageName;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
#set( $componentConfig = "${componentName}Configuration" )
import ${componentPackage}.${componentConfig};
#foreach ( $api in $apis )
import ${componentPackage}.${helper.getEndpointConfig($api.ProxyClass)};
#end
import org.apache.camel.util.component.ApiCollection;
import org.apache.camel.util.component.ApiMethod;
import org.apache.camel.util.component.ApiMethodHelper;
/**
* Camel {@link ApiCollection} for $componentName
*/
public final class $collectionName extends ApiCollection<${apiNameEnum}, ${componentConfig}> {
private static $collectionName collection;
private ${collectionName}() {
final Map aliases = new HashMap();
final Map<${apiNameEnum}, ApiMethodHelper extends ApiMethod>> apiHelpers = new HashMap<>();
final Map, ${apiNameEnum}> apiMethods = new HashMap<>();
List nullableArgs;
#foreach( $api in $apis )
aliases.clear();
#foreach( $alias in $api.Aliases )
aliases.put("$alias.MethodPattern", "$alias.MethodAlias");
#end
#set( $apiMethod = ${helper.getApiMethod($api.ProxyClass)} )
#set( $apiName = "${apiNameEnum}.${helper.getEnumConstant($api.ApiName)}" )
nullableArgs = Arrays.asList(${helper.getNullableOptionValues($api.NullableOptions)});
apiHelpers.put($apiName, new ApiMethodHelper<$apiMethod>(${apiMethod}.class, aliases, nullableArgs));
apiMethods.put(${apiMethod}.class, ${apiName});
#end
setApiHelpers(apiHelpers);
setApiMethods(apiMethods);
}
public $componentConfig getEndpointConfiguration(${apiNameEnum} apiName) {
$componentConfig result = null;
switch (apiName) {
#foreach( $api in $apis )
case ${helper.getEnumConstant($api.ApiName)}:
result = new ${helper.getEndpointConfig($api.ProxyClass)}();
break;
#end
}
return result;
}
public static synchronized $collectionName getCollection() {
if (collection == null) {
collection = new $collectionName();
}
return collection;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy