templates.velocity.casban.perschema.jsoncodec.vm Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sql2java-generator Show documentation
Show all versions of sql2java-generator Show documentation
executable jar of sql2java generator
The newest version!
#parse( "schema.include.vm" )
#parse( "header.include.vm" )
#set ( $javaClassName = 'JsonCodec' )
$codewriter.setCurrentJavaFilename($pkg, "${javaClassName}.java")
package $pkg;
#####################
#if($codewriter.fastjsonClassDeserializer)
import gu.sql2java.json.FastjsonDeserializer;
#end
#if($codewriter.jacksonClassDeserializer)
import gu.sql2java.json.JacksonDeserializer;
#end
/**
* JSON deserializer declaration
* @author guyadong
*/
public class $javaClassName {
#foreach($table in $tables)
#set ( $beanClass = ${table.asBeanClassNSP()} )
#if($codewriter.fastjsonClassDeserializer)
public static class ${beanClass}FastjsonDeserializer extends FastjsonDeserializer{
public ${beanClass}FastjsonDeserializer() {
super(Constant.$table.asConstantVar()_CLASS);
}
}
#end
#if($codewriter.jacksonClassDeserializer)
public static class ${beanClass}JacksonDeserializer extends JacksonDeserializer{
private static final long serialVersionUID = ${table.getSerialVersionUID("${pkg}.${javaClassName}.${beanClass}JacksonDeserializer")}L;
public ${beanClass}JacksonDeserializer() {
super(Constant.$table.asConstantVar()_CLASS);
}
}
#end
#end
}