Package

play.api.data

validation

Permalink

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
Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. validation
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Visibility
  1. Public
  2. All

Type Members

  1. case class Constraint[-T](name: Option[String], args: Seq[Any])(f: (T) ⇒ ValidationResult) extends Product with Serializable

    Permalink

    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

  2. trait Constraints extends AnyRef

    Permalink

    Defines a set of built-in constraints.

  3. case class Invalid(errors: Seq[ValidationError]) extends ValidationResult with Product with Serializable

    Permalink

    Validation was a failure.

    Validation was a failure.

    errors

    the resulting errors

  4. case class ValidationError(messages: Seq[String], args: Any*) extends Product with Serializable

    Permalink

    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

  5. sealed trait ValidationResult extends AnyRef

    Permalink

    A validation result.

Value Members

  1. object Constraint extends Serializable

    Permalink

    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.")
    }
  2. object Constraints extends Constraints

    Permalink

    Defines a set of built-in constraints.

  3. object Invalid extends Serializable

    Permalink

    This object provides helper methods to construct Invalid values.

  4. object ParameterValidator

    Permalink
  5. object Valid extends ValidationResult with Product with Serializable

    Permalink

    Validation was a success.

  6. object ValidationError extends Serializable

    Permalink

Inherited from AnyRef

Inherited from Any

Ungrouped