play.api.data.validation
package play.api.data.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.")
}
Attributes
Members list
Type members
Classlikes
A form constraint.
A form constraint.
Type parameters
- T
-
type of values handled by this constraint
Value parameters
- args
-
the message arguments, to format the constraint name
- f
-
the validation function
- name
-
the constraint name, to be displayed to final user
Attributes
- Companion
- object
- Supertypes
object Constraint
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.")
}
Attributes
- Companion
- class
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Constraint.type
object Constraints extends Constraints
Defines a set of built-in constraints.
Defines a set of built-in constraints.
Attributes
- Companion
- trait
- Supertypes
- Self type
-
Constraints.type
trait Constraints
Defines a set of built-in constraints.
Defines a set of built-in constraints.
Attributes
- Companion
- object
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
object Constraints.type
case class Invalid(errors: Seq[ValidationError]) extends ValidationResult
Validation was a failure.
Validation was a failure.
Value parameters
- errors
-
the resulting errors
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait ValidationResultclass Objecttrait Matchableclass AnyShow all
object Invalid
object ParameterValidator
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
ParameterValidator.type
case object Valid extends ValidationResult
A validation error.
object ValidationError
Attributes
- Companion
- class
- Supertypes
- Self type
-
ValidationError.type
In this article