aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetro Verkhogliad <vpetro@gmail.com>2016-09-27 18:01:53 -0400
committerPetro Verkhogliad <vpetro@gmail.com>2016-09-27 18:01:53 -0400
commit9f61546097e454d54c7633f5eba94fa0afbfbd1b (patch)
treeb42f57ee689913cf1c3b6bded0d663fe3fd57648
parente8b87c89f7acdd46b9a57058f57eb25f7a718daf (diff)
downloadslick-codegen-plugin-9f61546097e454d54c7633f5eba94fa0afbfbd1b.tar.gz
slick-codegen-plugin-9f61546097e454d54c7633f5eba94fa0afbfbd1b.tar.bz2
slick-codegen-plugin-9f61546097e454d54c7633f5eba94fa0afbfbd1b.zip
Correct header and final case classes
-rw-r--r--src/main/scala/NamespacedCodegen.scala9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/main/scala/NamespacedCodegen.scala b/src/main/scala/NamespacedCodegen.scala
index 651094b..9c6d126 100644
--- a/src/main/scala/NamespacedCodegen.scala
+++ b/src/main/scala/NamespacedCodegen.scala
@@ -90,8 +90,9 @@ class Generator(uri: URI, pkg: String, dbModel: Model, outputPath: String, manua
| // TODO: the name for this implicit should be changed in driver core
| implicit val tColType = MappedColumnType.base[com.drivergrp.core.time.Time, Long](time => time.millis, com.drivergrp.core.time.Time(_))
| ${tableCode}
+ |
|}
- """.stripMargin
+ |// scalastyle:on""".stripMargin
writeStringToFile(
packageName + allImports + generatedSchema,
@@ -110,7 +111,7 @@ class Generator(uri: URI, pkg: String, dbModel: Model, outputPath: String, manua
override def Table = new Table(_) { table =>
// need this in order to use our own TableClass generator
- override def definitions = Seq[Def]( EntityType, PlainSqlMapper, TableClassRef, TableValue )
+ override def definitions = Seq[Def]( EntityTypeRef, PlainSqlMapper, TableClassRef, TableValue )
def TableClassRef = new TableClass() {
// We disable the option mapping, as it is a bit more complex to support and we don't appear to need it
@@ -139,6 +140,10 @@ class Generator(uri: URI, pkg: String, dbModel: Model, outputPath: String, manua
else s"(a : ${TableClass.elementType}) => Some(" + columns.map("a."+_.name ).mkString("::") + ":: HNil)"
+ def EntityTypeRef = new EntityTypeDef {
+ override def code: String = (if (classEnabled) "final " else "") + super.code
+ }
+
override def Column = new Column(_) {
column =>