Example

Person

  • case class Person(age: Int, name: String, postcode: String)

  • Age must be between 0 and 130

  • Name must start with upper-case character

  • Postcode must be 4 digits