Permalink
Browse files

make generated case classes final by default.

1 parent bd3c24b commit 0e869e94b1523cae2774c078d274fd706d6ae3bb @stewSquared stewSquared committed Dec 9, 2016
@@ -117,8 +117,10 @@ abstract class AbstractGenerator[Code,TermName,TypeName](model: m.Model)
trait EntityTypeDef extends TypeDef{
/** Column types */
def types: Code = compoundType(columns.map(_.exposedType))
- /** Indicated whether a case class should be generated. Otherwise a type alias. */
+ /** Indicates whether a case class should be generated. Otherwise a type alias. */
def classEnabled = mappingEnabled
+ /** Indicates whether a generated case class should be final. */
+ def caseClassFinal = true
def doc =
if(classEnabled){
s"Entity class storing rows of table ${TableValue.name}\n" +
@@ -78,6 +78,7 @@ abstract class AbstractSourceCodeGenerator(model: m.Model)
).mkString(", ")
if(classEnabled){
val prns = (parents.take(1).map(" extends "+_) ++ parents.drop(1).map(" with "+_)).mkString("")
+ (if(caseClassFinal) "final " else "") +
s"""case class $name($args)$prns"""
} else {
s"""

0 comments on commit 0e869e9

Please sign in to comment.