templates.generic.generic.interface.vm Maven / Gradle / Ivy
#parse("${include}/generic.include.vm")
#set ( $className ="${sourceinfo.shellInterface.simpleName}Generic")
$codewriter.setCurrentJavaFilename("$pkg", "${className}.java")
#set ( $IOException =$CLASS.forName("java.io.IOException"))
#set ( $serviceInfo = $sourceinfo.serviceInfo)
#addIntoImports($IOException)
package $pkg;
#if($sourceinfo.hasRemoteResolveType)
##添加Generic引用
#addIntoImports($TOOL.getAnnotationRemoteClass())
#end
#outputImports()
#macro(defineLocalResolvedMethod $type)
/**
* 参见{@link $method.getDocSignature($imports,$pkg)}
#foreach( $parameter in $method.parameters)
* @param $parameter.name #if($sourceinfo.needDeriveParam($method,$parameter))#typeName($type)#end
#end
* @return #typeName($method.genericReturnType)
#foreach( $exception in $throwExceptions)
* @throws #typeName($exception)
#end
* @see $method.getDocSignature($imports,$pkg)
*/
//$methodCount
public #typeName($method.genericReturnType) $method.name (#join($method.parameters '#if($sourceinfo.needDeriveParam($method,$e))#typeName($type)#else#typeName($e.type)#end $e.name' ',')) #fillThrows($throwExceptions);
#end
#macro(defineRemoteResolvedMethod $type)
/**
* 参见{@link $method.getDocSignature($imports,$pkg)}
#foreach( $parameter in $method.parameters)
* @param $parameter.name
#if($sourceinfo.needDeriveParam($method,$parameter))
* {@link #typeName($type)}
* 本地调用时{@link #typeName($IOException)}以{@link RuntimeException}封装抛出
* 远程(webservice)调用时,将数据以{@link #typeName($serviceInfo.bridgeType)}形式发送到服务器解析成{@link #typeName($serviceInfo.targetType)}
#end
#end
* @return #typeName($method.genericReturnType)
#foreach( $exception in $declaredExceptions)
* @throws #typeName($exception)
#end
* @see $method.getDocSignature($imports,$pkg)
*/
@#typeName($TOOL.getAnnotationRemoteClass())(primtiveName="$method.name",genericParam={#join($sourceinfo.getDeriveParameterNames($method) '"$e"' ',')})//$methodCount
public #typeName($method.genericReturnType) ${method.name}By$type.simpleName (#join($method.parameters '#if($sourceinfo.needDeriveParam($method,$e))#typeName($type)#else#typeName($e.type)#end $e.name' ',')) #fillThrows($declaredExceptions);
#end
/**
* {@link #typeName($interfaceClass)}对应的泛型接口
* 所有#typeName($serviceInfo.targetType)的参数都支持泛型参数,参见 {@link net.gdface.utils.BinaryUtils#getBytesNotEmpty(Object)}
* 注意:
* 参数为{@link java.io.InputStream}的方法返回时会自动执行{@link java.io.InputStream#close()}关闭流
* 参见参见 {@link net.gdface.utils.BinaryUtils#readBytes(InputStream)}
* $GENERAED_BY
* @author guyadong
*/
public interface ${className}{
#set($methodCount = 0 )
#foreach ($method in $methods)
#set($methodCount= $methodCount + 1 )
#set ($declaredExceptions = $TOOL.sortByName($method.genericExceptionTypeSet))
#set ($throwExceptions = $declaredExceptions)
#set($tmp=$throwExceptions.add($IOException))
/**
* {@link $method.getDocSignature($imports,$pkg)}对应的泛型方法
#foreach( $parameter in $method.parameters) * @param $parameter.name
#if($sourceinfo.needGeneric($parameter))
* 泛型参数,参见 {@link net.gdface.utils.BinaryUtils#getBytesNotEmpty(Object)}
#end
#end
* @return #typeName($method.genericReturnType)
#foreach( $exception in $throwExceptions)
* @throws #typeName($exception)
#end
* @see $method.getDocSignature($imports,$pkg)
*/
//$methodCount
public #typeParametersDefine() #typeName($method.genericReturnType) $method.name (#join($method.parameters '#pamameterType($e) $e.name' ',')) #fillThrows($throwExceptions);
#if($sourceinfo.getDeriveMethodAnnotation($method))
#set($deriveAnnotation=$sourceinfo.getDeriveMethodAnnotation($method))
#foreach($type in $deriveAnnotation.localResolvedTypes())
#set($methodCount= $methodCount + 1 )
#defineLocalResolvedMethod($type)
#end
#foreach($type in $deriveAnnotation.remoteResolveTypes())
#set($methodCount= $methodCount + 1 )
#defineRemoteResolvedMethod($type)
#end
#end
#end
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy