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

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

There is a newer version: 3.5.0
Show newest version
#macro(returnValue $type $statement)##
#if($sourceinfo.sameWithThriftDecoratorType($type))${statement}##
#elseif($TOOL.isByteBuffer($type))##
TypeTransformer.getInstance().to(
                    ${statement},
                    #typeName($type).class,
                    ${sourceinfo.toThriftDecoratorType($type)}.class)##
#elseif($schemainfo.isThriftBuildinType($type) || $TOOL.isArrayOfbyte($type))${statement}##
#elseif($schemainfo.isfloat($type) && ${sourceinfo.toThriftType($type).endsWith("Double")})(${statement}==null)?null:${statement}.doubleValue()##
#elseif($schemainfo.isfloat($type) && ${sourceinfo.toThriftType($type).equals("double")})(${sourceinfo.toThriftType($type)})${statement}##
#elseif($schemainfo.isfloat($type))${statement}##
#elseif($schemainfo.isCastType($type))##
TypeTransformer.getInstance().to(
                    ${statement},
                    #typeName($type).class,
                    ${sourceinfo.toThriftDecoratorType($type)}.class)##
#elseif($schemainfo.isMap($type))##
#set($typeArgs = $schemainfo.getActualTypeArguments($type))##
TypeTransformer.getInstance().to(
                    ${statement},
                    #typeName($typeArgs[0]).class,
                    #typeName($typeArgs[1]).class,
                    ${sourceinfo.toThriftDecoratorType($typeArgs[0])}.class,
                    ${sourceinfo.toThriftDecoratorType($typeArgs[1])}.class)##
#elseif($schemainfo.isCollection($type))##
#set($typeArgs = $schemainfo.getActualTypeArguments($type))##
TypeTransformer.getInstance().to(
                    ${statement},
                    #typeName($typeArgs[0]).class,
                    ${sourceinfo.toThriftDecoratorType($typeArgs[0])}.class)##
#elseif($type.array && !$schemainfo.isBinary($type))##
#set($componentType = $type.componentType )##
TypeTransformer.getInstance().to(
                    ${statement},
                    #typeName($componentType).class,
                    ${sourceinfo.toThriftDecoratorType($componentType)}.class)##
#else##
TypeTransformer.getInstance().to(
                    ${statement},
                    #typeName($type).class,
                    ${sourceinfo.toThriftDecoratorType($type)}.class)##
#end##
#end##
#macro(setValue $type $statement)##
#if($sourceinfo.sameThriftDecoratorType($type))${statement}##
#elseif($TOOL.isByteBuffer($type))##
TypeTransformer.getInstance().to(
                    ${statement},
                    ${sourceinfo.toThriftDecoratorType($type)}.class,
                    #typeName($type).class)##
#elseif($schemainfo.isThriftBuildinType($type) || $TOOL.isArrayOfbyte($type))${statement}##
#elseif($schemainfo.isfloat($type))(#typeName($type))${statement}##
#elseif($schemainfo.isCastType($type))##
TypeTransformer.getInstance().to(
                    ${statement},
                    ${sourceinfo.toThriftDecoratorType($type)}.class,
                    #typeName($type).class)##
#elseif($schemainfo.isMap($type))##
#set($typeArgs = $schemainfo.getActualTypeArguments($type))##
TypeTransformer.getInstance().to(
                    ${statement},
                    ${sourceinfo.toThriftDecoratorType($typeArgs[0])}.class,
                    ${sourceinfo.toThriftDecoratorType($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.toThriftDecoratorType($typeArgs[0])}.class,
                    #typeName($typeArgs[0]).class)##
#elseif($schemainfo.isPrimitiveArray($type))##
#set($componentType = $type.componentType )##
TypeTransformer.getInstance().to${componentType.name}Array(
                    ${statement},
                    ${sourceinfo.toThriftDecoratorType($componentType)}.class,
                    #typeName($componentType).class)##
#elseif($type.array && !$schemainfo.isBinary($type))##
#set($componentType = $type.componentType )##
TypeTransformer.getInstance().toArray(
                    ${statement},
                    ${sourceinfo.toThriftDecoratorType($componentType)}.class,
                    #typeName($componentType).class)##
#else##
TypeTransformer.getInstance().to(
                    ${statement},
                    ${sourceinfo.toThriftDecoratorType($type)}.class,
                    #typeName($type).class)##
#end##
#end##
#macro (fillThriftThrows $exceptions)
throws #join($exceptions '${sourceinfo.toThriftDecoratorType($e)},' '')#typeName($schemainfo.serviceRuntimeExceptionClass)
#end
#macro (fillExcOfThriftMethod $exceptions)
#if( $exceptions.size()>0 )
exception = {#join($exceptions,'
                @ThriftException(type=${sourceinfo.toThriftDecoratorType($e)}.class, id=$velocityCount),','') 

#set($lastExpCount = $exceptions.size() + 1)
                @ThriftException(type=#typeName($schemainfo.serviceRuntimeExceptionClass).class, id=$lastExpCount)
                }##
#end
#end




© 2015 - 2025 Weber Informatics LLC | Privacy Policy