I want to write a custom Constraint to use it in my Form for validation. Mappings in Form have a verifying function: verifying (constraints: Constraint[T]*): Mapping[T]
.
I can obviously use the built in constraints, e.g. "name" -> text.verifying(nonEmpty)
.
Now I need my own constraint though. The Constraint case class looks like: case class Constraint [-T] (name: Option[String], args: Seq[Any], f: (T) ⇒ ValidationResult) extends Product with Serializable
But when I looked at ValidationResult, I just see an empty trait, see here - http://www.playframework.org/documentation/api/2.0.2/scala/index.html#play.api.data.validation.ValidationResult. So how can I define my own Constraint?