Squeryl Entity.eotemplate
Last modified by Ravi Mendis on 2011/05/18 04:50
This set of templates will generate a Squeryl schema from an EO model. Still basic/proof-of-concept templates. Of course, you may customize them further.
#if ($entity.packageName)
package $entity.packageName
#end
import java.util.Date
class ${entity.classNameWithoutPackage}(
##
##java -> Scala types go here
##
#foreach ($attribute in $entity.sortedAttributes)
#if ($attribute.javaClassName.equals("Integer")) #set( $scalaClassName = "Long" )
#elseif ($attribute.javaClassName.equals("String")) #set( $scalaClassName = "String" )
#elseif ($attribute.javaClassName.contains("BigDecimal")) #set( $scalaClassName = "BigDecimal" )
#elseif ($attribute.javaClassName.equals("NSTimestamp")) #set( $scalaClassName = "Date" )
#elseif ($attribute.javaClassName.equals("NSData")) #set( $scalaClassName = "Array[Byte]" ) #end
val ${attribute.name}:#if ($attribute.allowsNull) Option[$scalaClassName]#else $scalaClassName#end#if (!$attribute.equals($entity.sortedAttributes.last())),
#else
#end
#end) extends _${entity.classNameWithoutPackage}(
##
##java -> Scala types go here
##
#foreach ($attribute in $entity.sortedAttributes)
#if ($attribute.javaClassName.equals("Integer")) #set( $scalaClassName = "Long" )
#elseif ($attribute.javaClassName.equals("String")) #set( $scalaClassName = "String" )
#elseif ($attribute.javaClassName.contains("BigDecimal")) #set( $scalaClassName = "BigDecimal" )
#elseif ($attribute.javaClassName.equals("NSTimestamp")) #set( $scalaClassName = "Date" )
#elseif ($attribute.javaClassName.equals("NSData")) #set( $scalaClassName = "Array[Byte]" ) #end
${attribute.name}#if (!$attribute.equals($entity.sortedAttributes.last())),
#else
#end
#end) {
}
object $entity.classNameWithoutPackage {
}