All Downloads are FREE. Search and download functionalities are using the official Maven repository.

templates.thrift.include.decorator.include.vm Maven / Gradle / Ivy

There is a newer version: 3.5.0
Show newest version
#macro(returnValue $type $statement)##
#if($schemainfo.isThriftBuildinType($type))${statement}##
#elseif($schemainfo.isPrimitivefloat($type))(double)${statement}##
#elseif($schemainfo.isCastType($type))##
TypeTransformer.getInstance().to(
                    ${statement},
                    #typeName($type).class,
                    ${sourceinfo.toThriftType($type)}.class)##
#elseif($schemainfo.isMap($type))##
#set($typeArgs = $schemainfo.getActualTypeArguments($type))##
TypeTransformer.getInstance().to(
                    ${statement},
                    #typeName($typeArgs[0]).class,
                    #typeName($typeArgs[1]).class,
                    ${sourceinfo.toThriftType($typeArgs[0])}.class,
                    ${sourceinfo.toThriftType($typeArgs[1])}.class)##
#elseif($schemainfo.isCollection($type))##
#set($typeArgs = $schemainfo.getActualTypeArguments($type))##
TypeTransformer.getInstance().to(
                    ${statement},
                    #typeName($typeArgs[0]).class,
                    ${sourceinfo.toThriftType($typeArgs[0])}.class)##
#elseif($type.array && !$schemainfo.isBinary($type))##
#set($componentType = $type.componentType )##
TypeTransformer.getInstance().to(
                    ${statement},
                    #typeName($componentType).class,
                    ${sourceinfo.toThriftType($componentType)}.class)##
#else##
TypeTransformer.getInstance().to(
                    ${statement},
                    #typeName($type).class,
                    ${sourceinfo.toThriftType($type)}.class)##
#end##
#end##
#macro(setValue $type $statement)##
#if($schemainfo.isThriftBuildinType($type))${statement}##
#elseif($schemainfo.isPrimitivefloat($type))(float)${statement}##
#elseif($schemainfo.isCastType($type))##
TypeTransformer.getInstance().to(
                    ${statement},
                    ${sourceinfo.toThriftType($type)}.class,
                    #typeName($type).class)##
#elseif($schemainfo.isMap($type))##
#set($typeArgs = $schemainfo.getActualTypeArguments($type))##
TypeTransformer.getInstance().to(
                    ${statement},
                    ${sourceinfo.toThriftType($typeArgs[0])}.class,
                    ${sourceinfo.toThriftType($typeArgs[1])}.class,
                    #typeName($typeArgs[0]).class,
                    #typeName($typeArgs[1]).class)##
#elseif($schemainfo.isCollection($type))##
#set($typeArgs = $schemainfo.getActualTypeArguments($type))##
TypeTransformer.getInstance().to(
                    ${statement},
                    ${sourceinfo.toThriftType($typeArgs[0])}.class,
                    #typeName($typeArgs[0]).class)##
#elseif($schemainfo.isPrimitiveArray($type))##
#set($componentType = $type.componentType )##
TypeTransformer.getInstance().to${componentType.name}Array(
                    ${statement},
                    ${sourceinfo.toThriftType($componentType)}.class,
                    #typeName($componentType).class)##
#elseif($type.array && !$schemainfo.isBinary($type))##
#set($componentType = $type.componentType )##
TypeTransformer.getInstance().toArray(
                    ${statement},
                    ${sourceinfo.toThriftType($componentType)}.class,
                    #typeName($componentType).class)##
#else##
TypeTransformer.getInstance().to(
                    ${statement},
                    ${sourceinfo.toThriftType($type)}.class,
                    #typeName($type).class)##
#end##
#end##
#macro (fillThriftThrows $exceptions)
throws #join($exceptions '${sourceinfo.toThriftType($e)},' '')#typeName($schemainfo.serviceRuntimeExceptionClass)
#end
#macro (fillExcOfThriftMethod $exceptions)
#if( $exceptions.size()>0 )
,exception = {#join($exceptions,'
                @ThriftException(type=${sourceinfo.toThriftType($e)}.class, id=$velocityCount),','') 

#set($lastExpCount = $exceptions.size() + 1)
                @ThriftException(type=#typeName($schemainfo.serviceRuntimeExceptionClass).class, id=$lastExpCount)
                }##
#end
#end
#macro (paramRequire $parm)
#if(!$param.type.primitive && ${param.getAnnotation($CodegenRequiredClass)})
#set($ann = ${param.getAnnotation($CodegenRequiredClass)})
#if(${ann.value()})
@com.facebook.swift.codec.ThriftField(requiredness = com.facebook.swift.codec.ThriftField.Requiredness.REQUIRED) ##
#end
#end
#end
#macro (propertyRequire $prop)
#if($prop.propertyType.primitive)
Requiredness.REQUIRED##
#elseif(${TOOL.toPrimitiveType($prop.propertyType).primitive} && ${TOOL.extractFieldAnnotation($prop,$CodegenInvalidValueClass)})
Requiredness.REQUIRED##
#elseif(${TOOL.extractFieldAnnotation($prop,$CodegenRequiredClass)})
#set($ann = ${TOOL.extractFieldAnnotation($prop,$CodegenRequiredClass)})
#if(${ann.value()})
Requiredness.REQUIRED##
#else
Requiredness.OPTIONAL##
#end
#else
Requiredness.OPTIONAL##
#end
#end
#macro (renderCodegen $prop)
#if($sourceinfo.needRenderCodegen($prop))
    $!{sourceinfo.renderCodegenInvalidValue($prop)}$!{sourceinfo.renderCodegenDefaultValue($prop)}$!{sourceinfo.renderCodegenLength($prop)}$!{sourceinfo.renderCodegenRequired($prop)}
#end
#end
#macro(importCodegen)
#if(${sourceinfo.useCodegenInvalidValue})
import com.gitee.l0km.codegen.annotations.CodegenInvalidValue;
#end
#if(${sourceinfo.useCodegenDefaultvalue})
import com.gitee.l0km.codegen.annotations.CodegenDefaultvalue;
#end
#if(${sourceinfo.useCodegenLength})
import com.gitee.l0km.codegen.annotations.CodegenLength;
#end
#if(${sourceinfo.useCodegenRequired})
import com.gitee.l0km.codegen.annotations.CodegenRequired;
#end
#end




© 2015 - 2025 Weber Informatics LLC | Privacy Policy