abstract class FutureTransformer[-A, +B] extends AnyRef
An alternative interface for performing Future transformations;
that is, converting a Future[A] to a Future[B]. This interface is
designed to be friendly to Java users since it does not require
creating many small Function objects. It is used in conjunction
with transformedBy
.
You must override one of {map, flatMap}
. If you override both
map
and flatMap
, flatMap
takes precedence. If you fail to
override one of {map, flatMap}
, an AbstractMethodError
will be
thrown at Runtime.
Note: to end a result with a failure, we encourage you to use either
flatMap
or rescue
and return a failed Future, instead of throwing an
exception. A failed future can be used by returning
Future.exception(throwable)
instead of throwing an exception.
- See also
Future.transform which is the equivalent Scala API for further details.
Future.transformedBy for using it with a
Future
.FutureEventListener for a Java API for side-effects.
- Alphabetic
- By Inheritance
- FutureTransformer
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new FutureTransformer()
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- def flatMap(value: A): Future[B]
Invoked if the computation completes successfully.
Invoked if the computation completes successfully. Returns the new transformed value in a Future.
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def handle(throwable: Throwable): B
Invoked if the computation fails.
Invoked if the computation fails. Returns the new transformed value.
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def map(value: A): B
Invoked if the computation completes successfully.
Invoked if the computation completes successfully. Returns the new transformed value.
Note: this method will throw an
AbstractMethodError
if it is not overridden. - final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def rescue(throwable: Throwable): Future[B]
Invoked if the computation completes unsuccessfully.
Invoked if the computation completes unsuccessfully. Returns the new Future value.
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()