package validation
Contains the validation API used by Form
.
For example, to define a custom constraint:
val negative = Constraint[Int] { case i if i < 0 => Valid case _ => Invalid("Must be a negative number.") }
- Source
- package.scala
- Alphabetic
- By Inheritance
- validation
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
-
case class
Constraint[-T](name: Option[String], args: Seq[Any])(f: (T) ⇒ ValidationResult) extends Product with Serializable
A form constraint.
A form constraint.
- T
type of values handled by this constraint
- name
the constraint name, to be displayed to final user
- args
the message arguments, to format the constraint name
- f
the validation function
-
trait
Constraints extends AnyRef
Defines a set of built-in constraints.
-
case class
Invalid(errors: Seq[ValidationError]) extends ValidationResult with Product with Serializable
Validation was a failure.
Validation was a failure.
- errors
the resulting errors
-
case class
ValidationError(messages: Seq[String], args: Any*) extends Product with Serializable
A validation error.
A validation error.
- messages
the error message, if more then one message is passed it will use the last one
- args
the error message arguments
-
sealed
trait
ValidationResult extends AnyRef
A validation result.
Value Members
-
object
Constraint extends Serializable
This object provides helpers for creating
Constraint
values.This object provides helpers for creating
Constraint
values.For example:
val negative = Constraint[Int] { case i if i < 0 => Valid case _ => Invalid("Must be a negative number.") }
-
object
Constraints extends Constraints
Defines a set of built-in constraints.
-
object
Invalid extends Serializable
This object provides helper methods to construct
Invalid
values. - object ParameterValidator
-
object
Valid extends ValidationResult with Product with Serializable
Validation was a success.
- object ValidationError extends Serializable