templates.velocity.java5g.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
#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;
import gu.sql2java.json.FastjsonSerializer;
#end
#if($codewriter.jacksonClassDeserializer)
import gu.sql2java.json.JacksonDeserializer;
import gu.sql2java.json.JacksonSerializer;
#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(${beanClass}.class);
}
}
public static class ${beanClass}FastjsonSerializer extends FastjsonSerializer{
public ${beanClass}FastjsonSerializer() {
super(${beanClass}.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(${beanClass}.class);
}
}
public static class ${beanClass}JacksonSerializer extends JacksonSerializer{
private static final long serialVersionUID = ${table.getSerialVersionUID("${pkg}.${javaClassName}.${beanClass}JacksonSerializer")}L;
public ${beanClass}JacksonSerializer() {
super(${beanClass}.class);
}
}
#end
#end
}