play.api.data

Mapping

trait Mapping [T] extends AnyRef

A mapping is a two-way binder to handle a form field.

Self Type
Mapping[T]
Linear Supertypes
AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Hide All
  2. Show all
  1. Mapping
  2. AnyRef
  3. Any
Visibility
  1. Public
  2. All

Abstract Value Members

  1. def bind (data: Map[String, String]): Either[Seq[FormError], T]

    Binds this field, i.

    Binds this field, i.e. construct a concrete value from submitted data.

    data

    the submitted data

    returns

    either a concrete value of type T or a set of errors, if the binding failed

    Attributes
    abstract
  2. val constraints : Seq[Constraint[T]]

    The constraints associated with this field.

    The constraints associated with this field.

    Attributes
    abstract
  3. val key : String

    The field key.

    The field key.

    Attributes
    abstract
  4. val mappings : Seq[play.api.data.Mapping[_]]

    Sub-mappings (these can be seen as sub-keys).

    Sub-mappings (these can be seen as sub-keys).

    Attributes
    abstract
  5. def unbind (value: T): (Map[String, String], Seq[FormError])

    Unbinds this field, i.

    Unbinds this field, i.e. transforms a concrete value to plain data.

    value

    the value to unbind

    returns

    either the plain data or a set of errors, if the unbinding failed

    Attributes
    abstract
  6. def verifying (constraints: Constraint[T]*): Mapping[T]

    Constructs a new Mapping based on this one, by adding new constraints.

    Constructs a new Mapping based on this one, by adding new constraints.

    For example:

      import play.api.data._
      import validation.Constraints._
    
      Form("phonenumber" -> text.verifying(required) )
    
    constraints

    the constraints to add

    returns

    the new mapping

    Attributes
    abstract
  7. def withPrefix (prefix: String): Mapping[T]

    Constructs a new Mapping based on this one, adding a prefix to the key.

    Constructs a new Mapping based on this one, adding a prefix to the key.

    prefix

    the prefix to add to the key

    returns

    the same mapping, with only the key changed

    Attributes
    abstract

Concrete Value Members

  1. def != (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  2. def != (arg0: Any): Boolean

    Attributes
    final
    Definition Classes
    Any
  3. def ## (): Int

    Attributes
    final
    Definition Classes
    AnyRef → Any
  4. def == (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  5. def == (arg0: Any): Boolean

    Attributes
    final
    Definition Classes
    Any
  6. def addPrefix (prefix: String): Option[String]

    Attributes
    protected
  7. def applyConstraints (t: T): Either[Seq[FormError], T]

    Attributes
    protected
  8. def asInstanceOf [T0] : T0

    Attributes
    final
    Definition Classes
    Any
  9. def clone (): AnyRef

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  10. def collectErrors (t: T): Seq[FormError]

    Attributes
    protected
  11. def eq (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  12. def equals (arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  13. def finalize (): Unit

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  14. val format : Option[(String, Seq[Any])]

    The Format expected for this field, if it exists.

  15. def getClass (): java.lang.Class[_]

    Attributes
    final
    Definition Classes
    AnyRef → Any
  16. def hashCode (): Int

    Definition Classes
    AnyRef → Any
  17. def isInstanceOf [T0] : Boolean

    Attributes
    final
    Definition Classes
    Any
  18. def ne (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  19. def notify (): Unit

    Attributes
    final
    Definition Classes
    AnyRef
  20. def notifyAll (): Unit

    Attributes
    final
    Definition Classes
    AnyRef
  21. def synchronized [T0] (arg0: ⇒ T0): T0

    Attributes
    final
    Definition Classes
    AnyRef
  22. def toString (): String

    Definition Classes
    AnyRef → Any
  23. def transform [B] (f1: (T) ⇒ B, f2: (B) ⇒ T): Mapping[B]

    Transform this Mapping[T] to a Mapping[B].

    Transform this Mapping[T] to a Mapping[B].

    B

    The type of the new mapping.

    f1

    Transform value of T to a value of B

    f2

    Transform value of B to a value of T

  24. def verifying (error: ⇒ String, constraint: (T) ⇒ Boolean): Mapping[T]

    Constructs a new Mapping based on this one, by adding a new ad-hoc constraint.

    Constructs a new Mapping based on this one, by adding a new ad-hoc constraint.

    For example:

      import play.api.data._
      import validation.Constraints._
    
      Form("phonenumber" -> text.verifying("Bad phone number", {_.grouped(2).size == 5}))
    
    error

    The error message used if the constraint fails

    constraint

    a function describing the constraint that returns false on failure

    returns

    the new mapping

  25. def verifying (constraint: (T) ⇒ Boolean): Mapping[T]

    Constructs a new Mapping based on this one, by adding a new ad-hoc constraint.

    Constructs a new Mapping based on this one, by adding a new ad-hoc constraint.

    For example:

      import play.api.data._
      import validation.Constraints._
    
      Form("phonenumber" -> text.verifying {_.grouped(2).size == 5})
    
    constraint

    a function describing the constraint that returns false on failure

    returns

    the new mapping

  26. def wait (): Unit

    Attributes
    final
    Definition Classes
    AnyRef
    Annotations
    @throws()
  27. def wait (arg0: Long, arg1: Int): Unit

    Attributes
    final
    Definition Classes
    AnyRef
    Annotations
    @throws()
  28. def wait (arg0: Long): Unit

    Attributes
    final
    Definition Classes
    AnyRef
    Annotations
    @throws()

Inherited from AnyRef

Inherited from Any