Class/Object

play.api.data.mapping

Success

Related Docs: object Success | package mapping

Permalink

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

Linear Supertypes
Validation[E, A], AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Success
  2. Validation
  3. AnyRef
  4. Any
  1. Hide All
  2. Show all
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Success(value: A)

    Permalink

Type Members

  1. final class WithFilter extends AnyRef

    Permalink
    Definition Classes
    Validation

Value Members

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

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

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

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

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

    Permalink

    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

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

    Permalink

    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

    Permalink
  9. def clone(): AnyRef

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

    Permalink

    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

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

    Permalink
    Definition Classes
    Success → AnyRef → Any
  13. def fail: FailProjection[E, A]

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

    Permalink

    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
  15. def filter(p: (A) ⇒ Boolean): Validation[E, A]

    Permalink

    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
  16. def filterNot(p: (A) ⇒ Boolean): Validation[E, A]

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

    Permalink
    Definition Classes
    Validation
  18. def finalize(): Unit

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

    Permalink

    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
  20. def foreach(f: (A) ⇒ Unit): Unit

    Permalink

    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
  21. def get: A

    Permalink

    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
    SuccessValidation
  22. final def getClass(): Class[_]

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

    Permalink

    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
  24. def hashCode(): Int

    Permalink
    Definition Classes
    Success → AnyRef → Any
  25. def isFailure: Boolean

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

    Permalink
    Definition Classes
    Any
  27. def isSuccess: Boolean

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

    Permalink

    [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
  29. final def ne(arg0: AnyRef): Boolean

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

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

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

    Permalink

    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
  33. def recover[AA >: A](errManager: PartialFunction[Failure[E, A], AA]): Validation[E, AA]

    Permalink

    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
  34. def recoverTotal[AA >: A](errManager: (Failure[E, A]) ⇒ AA): AA

    Permalink

    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
  35. def success: SuccessProjection[E, A]

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

    Permalink
    Definition Classes
    AnyRef
  37. def toString(): String

    Permalink
    Definition Classes
    Success → AnyRef → Any
  38. val value: A

    Permalink
  39. def viaEither[EE, AA](f: (Either[Seq[E], A]) ⇒ Either[Seq[EE], AA]): Validation[EE, AA]

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

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

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

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

    Permalink

    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