Packages

c

play.api.data

FieldMapping

case class FieldMapping[T](key: String = "", constraints: Seq[Constraint[T]] = Nil)(implicit binder: Formatter[T]) extends Mapping[T] with Product with Serializable

A mapping for a single field.

key

the field key

constraints

the constraints associated with this field.

Source
Form.scala
Linear Supertypes
Serializable, Product, Equals, Mapping[T], AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. FieldMapping
  2. Serializable
  3. Product
  4. Equals
  5. Mapping
  6. AnyRef
  7. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new FieldMapping(key: String = "", constraints: Seq[Constraint[T]] = Nil)(implicit binder: Formatter[T])

    key

    the field key

    constraints

    the constraints associated with this field.

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def addPrefix(prefix: String): Option[String]
    Attributes
    protected
    Definition Classes
    Mapping
  5. def applyConstraints(t: T): Either[Seq[FormError], T]
    Attributes
    protected
    Definition Classes
    Mapping
  6. def as(binder: Formatter[T]): Mapping[T]

    Changes the binder used to handle this field.

    Changes the binder used to handle this field.

    binder

    the new binder to use

    returns

    the same mapping with a new binder

  7. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  8. def bind(data: Map[String, String]): Either[Seq[FormError], T]

    Binds this field, i.e.

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

    data

    the submitted data

    returns

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

    Definition Classes
    FieldMappingMapping
  9. implicit val binder: Formatter[T]
  10. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  11. def collectErrors(t: T): Seq[FormError]
    Attributes
    protected
    Definition Classes
    Mapping
  12. val constraints: Seq[Constraint[T]]

    The constraints associated with this field.

    The constraints associated with this field.

    Definition Classes
    FieldMappingMapping
  13. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  14. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  15. val format: Option[(String, Seq[Any])]

    The Format expected for this field, if it exists.

    The Format expected for this field, if it exists.

    Definition Classes
    FieldMappingMapping
  16. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  17. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  18. val key: String

    The field key.

    The field key.

    Definition Classes
    FieldMappingMapping
  19. val mappings: Seq[Mapping[_]]

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

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

    Definition Classes
    FieldMappingMapping
  20. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  21. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  22. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  23. def productElementNames: Iterator[String]
    Definition Classes
    Product
  24. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  25. 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

    Definition Classes
    Mapping
  26. def unbind(value: T): Map[String, String]

    Unbinds this field, i.e.

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

    value

    the value to unbind

    returns

    the plain data

    Definition Classes
    FieldMappingMapping
  27. def unbindAndValidate(value: T): (Map[String, String], Seq[FormError])

    Unbinds this field, i.e.

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

    value

    the value to unbind

    returns

    the plain data and any errors in the plain data

    Definition Classes
    FieldMappingMapping
  28. def verifying(addConstraints: 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) )
    addConstraints

    the constraints to add

    returns

    the new mapping

    Definition Classes
    FieldMappingMapping
  29. 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

    Definition Classes
    Mapping
  30. 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

    Definition Classes
    Mapping
  31. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  32. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  33. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  34. 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

    Definition Classes
    FieldMappingMapping

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from Mapping[T]

Inherited from AnyRef

Inherited from Any

Ungrouped