Skip to content

Instantly share code, notes, and snippets.

@nisshiee
Created July 24, 2012 12:47
Show Gist options
  • Save nisshiee/3169761 to your computer and use it in GitHub Desktop.
Save nisshiee/3169761 to your computer and use it in GitHub Desktop.
永続化の前後をクラスで表現する
case class Person(name: String, age: Int)
case class Person(id: Int, name: String, age: Int)
case class Person(id: Option[Int], name: String, age: Int)
sealed trait Person {
val name: String
val age: Int
}
case class IdentifiedPerson(id: Int, name: String, age: Int) extends Person
case class UnIdentifiedPerson(name: String, age: Int) extends Person
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment