In Play Framework, we use Scala sealed classes, case classes, and case objects to define model objects. Scala case classes are immutable and serializable.
Consider the following code, for example:
sealed class Message case object SuccessMessage extends Message case object FailureMessage extends Message
We also define some Forms using the Play Form API. Refer to the Play Framework Form-based web application section of this chapter for more information.