Class/Object

diode.util

Pot

Related Docs: object Pot | package util

Permalink

sealed abstract class Pot[+A] extends Product with Serializable

Represents a potential value that may be in different states.

Self Type
Pot[A]
Linear Supertypes
Serializable, Serializable, Product, Equals, AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Pot
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. AnyRef
  7. Any
  1. Hide All
  2. Show all
Visibility
  1. Public
  2. All

Type Members

  1. class WithFilter extends AnyRef

    Permalink

    We need a whole WithFilter class to honor the "doesn't create a new collection" contract even though it seems unlikely to matter much in a collection with max size 1.

Abstract Value Members

  1. abstract def canEqual(that: Any): Boolean

    Permalink
    Definition Classes
    Equals
  2. abstract def fail(exception: Throwable): Pot[A]

    Permalink
  3. abstract def get: A

    Permalink
  4. abstract def isEmpty: Boolean

    Permalink
  5. abstract def isFailed: Boolean

    Permalink
  6. abstract def isPending: Boolean

    Permalink
  7. abstract def isStale: Boolean

    Permalink
  8. abstract def pending(policy: RetryPolicy = Retry.None): Pot[A]

    Permalink
  9. abstract def productArity: Int

    Permalink
    Definition Classes
    Product
  10. abstract def productElement(n: Int): Any

    Permalink
    Definition Classes
    Product
  11. abstract def retry(policy: RetryPolicy): Pot[A]

    Permalink
  12. abstract def retryPolicy: RetryPolicy

    Permalink
  13. abstract def state: PotState

    Permalink

Concrete 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. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  6. final def collect[B](pf: PartialFunction[A, B]): Pot[B]

    Permalink

    Returns a Ready containing the result of applying pf to this Pot's contained value, if this pot is nonempty and pf is defined for that value.

    Returns a Ready containing the result of applying pf to this Pot's contained value, if this pot is nonempty and pf is defined for that value. Returns Empty otherwise.

    pf

    the partial function.

    returns

    the result of applying pf to this Pot's value (if possible), or Empty.

    Annotations
    @inline()
    Example:
    1. // Returns Ready(HTTP) because the partial function covers the case.
      Ready("http") collect {case "http" => "HTTP"}
      // Returns Empty because the partial function doesn't cover the case.
      Ready("ftp") collect {case "http" => "HTTP"}
      // Returns Empty because Empty is passed to the collect method.
      Empty collect {case value => value}
  7. final def contains[A1 >: A](elem: A1): Boolean

    Permalink

    Tests whether the pot contains a given value as an element.

    Tests whether the pot contains a given value as an element.

    elem

    the element to test.

    returns

    true if the pot has an element that is equal (as determined by ==) to elem, false otherwise.

    Example:
    1. // Returns true because Ready instance contains string "something" which equals "something".
      Ready("something") contains "something"
      // Returns false because "something" != "anything".
      Ready("something") contains "anything"
      // Returns false when method called on Empty.
      Empty contains "anything"
  8. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  9. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  10. def exceptionOption: Option[Throwable]

    Permalink
  11. final def exists(p: (A) ⇒ Boolean): Boolean

    Permalink

    Returns true if this pot is nonempty and the predicate $p returns true when applied to this Pot's value.

    Returns true if this pot is nonempty and the predicate $p returns true when applied to this Pot's value. Otherwise, returns false.

    p

    the predicate to test

    Annotations
    @inline()
  12. final def filter(p: (A) ⇒ Boolean): Pot[A]

    Permalink

    Returns this Pot if it is nonempty and applying the predicate $p to this Pot's value returns true.

    Returns this Pot if it is nonempty and applying the predicate $p to this Pot's value returns true. Otherwise, return Empty.

    p

    the predicate used for testing.

    Annotations
    @inline()
  13. final def filterNot(p: (A) ⇒ Boolean): Pot[A]

    Permalink

    Returns this Pot if it is nonempty and applying the predicate $p to this Pot's value returns false.

    Returns this Pot if it is nonempty and applying the predicate $p to this Pot's value returns false. Otherwise, return Empty.

    p

    the predicate used for testing.

    Annotations
    @inline()
  14. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  15. final def flatMap[B](f: (A) ⇒ Pot[B]): Pot[B]

    Permalink

    Returns the result of applying $f to this Pot's value if this Pot is nonempty.

    Returns the result of applying $f to this Pot's value if this Pot is nonempty. Returns Empty if this Pot is empty. Slightly different from map in that $f is expected to return a pot (which could be Empty).

    f

    the function to apply

    Annotations
    @inline()
    See also

    foreach

    map

  16. def flatten[B](implicit ev: <:<[A, Pot[B]]): Pot[B]

    Permalink
  17. final def fold[B](ifEmpty: ⇒ B)(f: (A) ⇒ B): B

    Permalink

    Returns the result of applying $f to this Pot's value if the Pot is nonempty.

    Returns the result of applying $f to this Pot's value if the Pot is nonempty. Otherwise, evaluates expression ifEmpty.

    ifEmpty

    the expression to evaluate if empty.

    f

    the function to apply if nonempty.

    Annotations
    @inline()
    Note

    This is equivalent to Pot map f getOrElse ifEmpty.

  18. final def forall(p: (A) ⇒ Boolean): Boolean

    Permalink

    Returns true if this pot is empty or the predicate $p returns true when applied to this Pot's value.

    Returns true if this pot is empty or the predicate $p returns true when applied to this Pot's value.

    p

    the predicate to test

    Annotations
    @inline()
  19. final def foreach[U](f: (A) ⇒ U): Unit

    Permalink

    Apply the given procedure $f to the pot's value, if it is nonempty.

    Apply the given procedure $f to the pot's value, if it is nonempty. Otherwise, do nothing.

    f

    the procedure to apply.

    Annotations
    @inline()
    See also

    flatMap

    map

  20. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  21. final def getOrElse[B >: A](default: ⇒ B): B

    Permalink
    Annotations
    @inline()
  22. def hashCode(): Int

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

    Permalink
    Definition Classes
    Any
  24. def isReady: Boolean

    Permalink
  25. def iterator: Iterator[A]

    Permalink

    Returns a singleton iterator returning the Pot's value if it is nonempty, or an empty iterator if the pot is empty.

  26. final def map[B](f: (A) ⇒ B): Pot[B]

    Permalink

    Returns a Ready containing the result of applying $f to this Pot's value if this Pot is nonempty.

    Returns a Ready containing the result of applying $f to this Pot's value if this Pot is nonempty. Otherwise return Empty.

    f

    the function to apply

    Annotations
    @inline()
    Note

    This is similar to flatMap except here, $f does not need to wrap its result in a pot.

    See also

    foreach

    flatMap

  27. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  28. final def nonEmpty: Boolean

    Permalink

    Returns false if the pot is Empty, true otherwise.

    Returns false if the pot is Empty, true otherwise.

    Note

    Implemented here to avoid the implicit conversion to Iterable.

  29. final def notify(): Unit

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

    Permalink
    Definition Classes
    AnyRef
  31. final def orElse[B >: A](alternative: ⇒ Pot[B]): Pot[B]

    Permalink

    Returns this Pot if it is nonempty, otherwise return the result of evaluating alternative.

    Returns this Pot if it is nonempty, otherwise return the result of evaluating alternative.

    alternative

    the alternative expression.

    Annotations
    @inline()
  32. def productIterator: Iterator[Any]

    Permalink
    Definition Classes
    Product
  33. def productPrefix: String

    Permalink
    Definition Classes
    Product
  34. def ready[B >: A](value: B): Pot[B]

    Permalink
  35. def recover[B >: A](f: PartialFunction[Throwable, B]): Pot[B]

    Permalink

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

    Applies the given function f if this is a Failure, otherwise returns this if this is a Success. This is like map for the exception.

  36. def recoverWith[B >: A](f: PartialFunction[Throwable, Pot[B]]): Pot[B]

    Permalink

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

    Applies the given function f if this is a Failure, otherwise returns this if this is a Success. This is like flatMap for the exception.

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

    Permalink
    Definition Classes
    AnyRef
  38. final def toLeft[X](right: ⇒ X): Product with Serializable with Either[A, X]

    Permalink

    Returns a scala.util.Right containing the given argument right if this is empty, or a scala.util.Left containing this Pot's value if this Pot is nonempty.

    Returns a scala.util.Right containing the given argument right if this is empty, or a scala.util.Left containing this Pot's value if this Pot is nonempty.

    right

    the expression to evaluate and return if this is empty

    Annotations
    @inline()
    See also

    toRight

  39. def toList: List[A]

    Permalink

    Returns a singleton list containing the Pot's value if it is nonempty, or the empty list if the Pot is empty.

  40. def toOption: Option[A]

    Permalink

    Returns None if this is empty or a Some containing the value otherwise.

    Returns None if this is empty or a Some containing the value otherwise.

    Annotations
    @inline()
  41. final def toRight[X](left: ⇒ X): Product with Serializable with Either[X, A]

    Permalink

    Returns a scala.util.Left containing the given argument left if this Pot is empty, or a scala.util.Right containing this Pot's value if this is nonempty.

    Returns a scala.util.Left containing the given argument left if this Pot is empty, or a scala.util.Right containing this Pot's value if this is nonempty.

    left

    the expression to evaluate and return if this is empty

    Annotations
    @inline()
    See also

    toLeft

  42. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  43. def toTry: Try[A]

    Permalink

    Returns Failure if this has failed or a Success containing the value otherwise.

  44. final def wait(): Unit

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

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

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

    Permalink

    Necessary to keep Pot from being implicitly converted to scala.collection.Iterable in for comprehensions.

    Necessary to keep Pot from being implicitly converted to scala.collection.Iterable in for comprehensions.

    Annotations
    @inline()

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from AnyRef

Inherited from Any

Ungrouped