All Downloads are FREE. Search and download functionalities are using the official Maven repository.

scala-play-server.caseClass.mustache Maven / Gradle / Ivy

case class {{classname}}(
{{#vars}}
  {{&name}}: {{^required}}Option[{{/required}}{{#isEnum}}{{classname}}.{{enumName}}.Value{{/isEnum}}{{^isEnum}}{{dataType}}{{/isEnum}}{{^required}}]{{/required}}{{#hasMore}},{{/hasMore}}{{^hasMore}}{{#isMapModel}},{{/isMapModel}}{{/hasMore}}
{{/vars}}
{{#isMapModel}}
  additionalProperties: {{parent}}
{{/isMapModel}}
)

object {{classname}} {
  {{^vendorExtensions.x-has-files}}
  implicit lazy val {{classVarName}}JsonFormat: Format[{{classname}}] = {{^isMapModel}}Json.format[{{classname}}]{{/isMapModel}}{{#isMapModel}}{
    {{#lambda.indented_4}}{{>extensibleObjectJsonFormat}}{{/lambda.indented_4}}
  }{{/isMapModel}}
  {{/vendorExtensions.x-has-files}}
  {{#vendorExtensions.x-has-files}}
  // NOTE: The JSON format for {{classname}} was not generated because it contains a file variable which cannot be encoded to JSON.
  {{/vendorExtensions.x-has-files}}
  {{#vars}}
  {{#isEnum}}

  // noinspection TypeAnnotation
  object {{enumName}} extends Enumeration {
    {{#allowableValues}}
    {{#enumVars}}
    val {{name}} = Value({{&value}})
    {{/enumVars}}
    {{/allowableValues}}

    type {{enumName}} = Value
    implicit lazy val {{enumName}}JsonFormat: Format[Value] = Format(Reads.enumNameReads(this), Writes.enumNameWrites[this.type])
  }
  {{/isEnum}}
  {{/vars}}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy