play.api.data.mapping

Failure

class Failure[+E, +A] extends Validation[E, A]

Linear Supertypes
Validation[E, A], AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Failure
  2. Validation
  3. AnyRef
  4. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Failure(errors: Seq[E])

Type Members

  1. final class WithFilter extends AnyRef

    Definition Classes
    Validation

Value Members

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

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

    Definition Classes
    AnyRef → Any
  3. def *>[EE >: E, B](o: Validation[EE, B]): Validation[EE, B]

    Definition Classes
    Validation
  4. final def ==(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  5. def asEither: Either[Seq[E], A]

    Returns Left containing the errors if this is a Failure or a Right containing the value if this is a Success.

    Returns Left containing the errors if this is a Failure or a Right containing the value if this is a Success.

    Definition Classes
    Validation
  6. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  7. def asOpt: Option[A]

    Returns None if this is a Failure or a Some containing the value if this is a Success.

    Returns None if this is a Failure or a Some containing the value if this is a Success.

    Definition Classes
    Validation
  8. def canEqual(o: Any): Boolean

  9. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  10. def collect[EE >: E, B](otherwise: EE)(p: PartialFunction[A, B]): Validation[EE, B]

    Like map, but for partial function.

    Like map, but for partial function. If p us not defined for the value, it return a Failure

    val p: PartialFunction[Int, String] = { case 5 => "High five!" }
    Success(5).collect("OOoops")(p) == Success("High five!")
    Success(7).collect("OOoops")(p) == Failure(Seq("OOoops"))
    Failure(Seq("error")).collect("OOoops")(p) == Failure(Seq("error"))
    otherwise

    the error to return if the p is not defined

    p

    the partial function to apply if this is a Success

    returns

    a Success if this was a Success and p was defined, a Failure otherwise

    Definition Classes
    Validation
  11. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  12. def equals(o: Any): Boolean

    Definition Classes
    Failure → AnyRef → Any
  13. val errors: Seq[E]

  14. def fail: FailProjection[E, A]

    Definition Classes
    Validation
  15. def filter[EE >: E](otherwise: EE)(p: (A) ⇒ Boolean): Validation[EE, A]

    filter Successful Validation if it does not match the predicate p

    filter Successful Validation if it does not match the predicate p

    val isFive: Int => Boolean = _ == 5
    Success(5).filter("Not five")(isFive) == Success(5)
    Success(7).filter("Not five")(isFive) == Failure(Seq("Not five"))
    Failure(Seq("error")).filter("Not five")(isFive) == Failure(Seq("error"))
    otherwise

    the error to return if the predicate p is not verified

    p

    the predicate to apply if this is a Success

    returns

    a Success if this was a Success and the predicate matched, a Failure otherwise

    Definition Classes
    Validation
  16. def filter(p: (A) ⇒ Boolean): Validation[E, A]

    filter Successful Validation if it does not match the predicate p

    filter Successful Validation if it does not match the predicate p

    p

    the predicate to apply if this is a Success

    returns

    a Success if this was a Success and the predicate matched, a Failure otherwise

    Definition Classes
    Validation
  17. def filterNot(p: (A) ⇒ Boolean): Validation[E, A]

    Definition Classes
    Validation
  18. def filterNot[EE >: E](error: EE)(p: (A) ⇒ Boolean): Validation[EE, A]

    Definition Classes
    Validation
  19. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  20. def fold[X](invalid: (Seq[E]) ⇒ X, valid: (A) ⇒ X): X

    Applies invalid if this is a Failure or valid if this is a Success.

    Applies invalid if this is a Failure or valid if this is a Success.

    invalid

    the function to apply if this is a Failure

    valid

    the function to apply if this is a Success

    returns

    the results of applying the function

    Definition Classes
    Validation
  21. def foreach(f: (A) ⇒ Unit): Unit

    Applies the given function f if this is a Success, otherwise returns Unit if this is a Failure

    Applies the given function f if this is a Success, otherwise returns Unit if this is a Failure

    f

    the function to apply if this is a Success

    returns

    Unit

    Definition Classes
    Validation
  22. def get: Nothing

    Returns the value from this Success or throws the exception if this is a Failure.

    Returns the value from this Success or throws the exception if this is a Failure.

    Definition Classes
    FailureValidation
  23. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  24. def getOrElse[AA >: A](t: ⇒ AA): AA

    Returns the value from this Success or returns t if this is a Failure.

    Returns the value from this Success or returns t if this is a Failure.

    Definition Classes
    Validation
  25. def hashCode(): Int

    Definition Classes
    Failure → AnyRef → Any
  26. def isFailure: Boolean

    Definition Classes
    Validation
  27. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  28. def isSuccess: Boolean

    Definition Classes
    Validation
  29. def map[X](f: (A) ⇒ X): Validation[E, X]

    [use case] Builds a new Validation by applying a function to the value of this validation if it's a Success

    [use case] Builds a new Validation by applying a function to the value of this validation if it's a Success

    val f: Int => Int = _ + 2
    Success(5).map(f) == Success(7)
    Failure(Seq("error")).map(f) == Failure(Seq("error"))
    f

    the function to apply if this is a Success

    returns

    the result of applying the function

    Definition Classes
    Validation
  30. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  31. final def notify(): Unit

    Definition Classes
    AnyRef
  32. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  33. def orElse[EE >: E, AA >: A](t: ⇒ Validation[EE, AA]): Validation[EE, AA]

    Returns this Validation if it is a Success or returns t if it is a Failure.

    Returns this Validation if it is a Success or returns t if it is a Failure.

    Definition Classes
    Validation
  34. def recover[AA >: A](errManager: PartialFunction[Failure[E, A], AA]): Validation[E, AA]

    Applies the given partial function errManager if this is a Failure, otherwise returns this if this is a Success.

    Applies the given partial function errManager if this is a Failure, otherwise returns this if this is a Success.

    Definition Classes
    Validation
  35. def recoverTotal[AA >: A](errManager: (Failure[E, A]) ⇒ AA): AA

    Applies the given function errManager if this is a Failure, otherwise returns this if this is a Success.

    Applies the given function errManager if this is a Failure, otherwise returns this if this is a Success.

    Definition Classes
    Validation
  36. def success: SuccessProjection[E, A]

    Definition Classes
    Validation
  37. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  38. def toString(): String

    Definition Classes
    Failure → AnyRef → Any
  39. def viaEither[EE, AA](f: (Either[Seq[E], A]) ⇒ Either[Seq[EE], AA]): Validation[EE, AA]

    Definition Classes
    Validation
  40. final def wait(): Unit

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  43. def withFilter(p: (A) ⇒ Boolean): WithFilter

    Creates a non-strict filter of this Validation.

    Creates a non-strict filter of this Validation.

    Note: the difference between c filter p and c withFilter p is that the former creates a new vlaidation, whereas the latter only restricts the domain of subsequent map, flatMap, foreach, and withFilter operations.

    p

    the predicate used to test value.

    returns

    an object of class WithFilter, which supports map, flatMap, foreach, and withFilter operations. All these operations apply to the value of this Validation which satisfy the predicate p.

    Definition Classes
    Validation

Inherited from Validation[E, A]

Inherited from AnyRef

Inherited from Any

Ungrouped