Class

play.api.data

WrappedMapping

Related Doc: package data

Permalink

case class WrappedMapping[A, B](wrapped: Mapping[A], f1: (A) ⇒ B, f2: (B) ⇒ A, additionalConstraints: Seq[Constraint[B]] = Nil) extends Mapping[B] with Product with Serializable

A mapping wrapping another existing mapping with transformation functions.

wrapped

Existing wrapped mapping

f1

Transformation function from A to B

f2

Transformation function from B to A

additionalConstraints

Additional constraints of type B

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

Instance Constructors

  1. new WrappedMapping(wrapped: Mapping[A], f1: (A) ⇒ B, f2: (B) ⇒ A, additionalConstraints: Seq[Constraint[B]] = Nil)

    Permalink

    wrapped

    Existing wrapped mapping

    f1

    Transformation function from A to B

    f2

    Transformation function from B to A

    additionalConstraints

    Additional constraints of type B

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def addPrefix(prefix: String): Option[String]

    Permalink
    Attributes
    protected
    Definition Classes
    Mapping
  5. val additionalConstraints: Seq[Constraint[B]]

    Permalink

    Additional constraints of type B

  6. def applyConstraints(t: B): Either[Seq[FormError], B]

    Permalink
    Attributes
    protected
    Definition Classes
    Mapping
  7. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  8. def bind(data: Map[String, String]): Either[Seq[FormError], B]

    Permalink

    Binds this field, i.e.

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

    data

    the submitted data

    returns

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

    Definition Classes
    WrappedMappingMapping
  9. def clone(): AnyRef

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

    Permalink
    Attributes
    protected
    Definition Classes
    Mapping
  11. val constraints: Seq[Constraint[B]]

    Permalink

    The constraints associated with this field.

    The constraints associated with this field.

    Definition Classes
    WrappedMappingMapping
  12. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  13. val f1: (A) ⇒ B

    Permalink

    Transformation function from A to B

  14. val f2: (B) ⇒ A

    Permalink

    Transformation function from B to A

  15. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  16. val format: Option[(String, Seq[Any])]

    Permalink

    The Format expected for this field, if it exists.

    The Format expected for this field, if it exists.

    Definition Classes
    WrappedMappingMapping
  17. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  18. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  19. val key: String

    Permalink

    The field key.

    The field key.

    Definition Classes
    WrappedMappingMapping
  20. val mappings: Seq[Mapping[_]]

    Permalink

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

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

    Definition Classes
    WrappedMappingMapping
  21. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  22. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  23. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  24. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  25. def transform[B](f1: (B) ⇒ B, f2: (B) ⇒ B): Mapping[B]

    Permalink

    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: B): Map[String, String]

    Permalink

    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
    WrappedMappingMapping
  27. def unbindAndValidate(value: B): (Map[String, String], Seq[FormError])

    Permalink

    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
    WrappedMappingMapping
  28. def verifying(constraints: Constraint[B]*): Mapping[B]

    Permalink

    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

    Definition Classes
    WrappedMappingMapping
  29. def verifying(error: ⇒ String, constraint: (B) ⇒ Boolean): Mapping[B]

    Permalink

    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: (B) ⇒ Boolean): Mapping[B]

    Permalink

    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

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  34. def withPrefix(prefix: String): Mapping[B]

    Permalink

    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
    WrappedMappingMapping
  35. val wrapped: Mapping[A]

    Permalink

    Existing wrapped mapping

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from Mapping[B]

Inherited from AnyRef

Inherited from Any

Ungrouped