
wei-k.play-twenty-three-generator_2.11.0.2.0.source-code.Sequencer.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of play-twenty-three-generator_2.11 Show documentation
Show all versions of play-twenty-three-generator_2.11 Show documentation
generate over twenty three case classes play-json Reads/Writes/Format
The newest version!
package play.twentythree
object Sequencer {
def apply(n: Int): String = {
val tparams = (1 to n).map("A" + _)
val any = List.fill(n)("Any")
def returnType(types: Seq[String]) =
s"""Sequencer.Aux[${types.map("JsResult[" + _ + "]").mkString(" :: ")} :: HNil, JsResult[${types.mkString(" :: ")} :: HNil]]"""
s"""
private[this] val _sequence$n: ${returnType(any)} =
Sequencer.cons(
sequence${n - 1}[${any.tail.mkString(", ")}],
Apply2.apply2[Any, ${any.tail.mkString(" :: ")} :: HNil]
)
def sequence$n[${tparams.mkString(", ")}]: ${returnType(tparams)} =
_sequence$n.asInstanceOf[${returnType(tparams)}]"""
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy