public class PromiseImpl<ResultType> extends Object implements Promise<ResultType>
| Modifier and Type | Field and Description |
|---|---|
protected delight.async.Value<Throwable> |
failureCache |
protected delight.async.Operation<ResultType> |
operation |
| Constructor and Description |
|---|
PromiseImpl(delight.async.Operation<ResultType> operation) |
| Modifier and Type | Method and Description |
|---|---|
void |
addExceptionFallback(delight.functional.Closure<Throwable> closure)
Registeres a listener for exceptions, which is triggered when no
listeners have been defined using
Promise.catchExceptions(Closure) |
void |
apply(delight.async.callbacks.ValueCallback<ResultType> callback) |
ResultType |
cachedResult()
If this promises has been resolved, the result obtained will be returned
by this function.
|
void |
catchExceptions(delight.functional.Closure<Throwable> closure)
Register a listener of exceptions.
|
ResultType |
get()
Attempts to resolve this promise synchronously.
|
void |
get(delight.functional.Closure<ResultType> closure)
Attempts to resolve this promise asynchronously.
|
String |
toString() |
protected final delight.async.Operation<ResultType> operation
protected final delight.async.Value<Throwable> failureCache
public PromiseImpl(delight.async.Operation<ResultType> operation)
public void apply(delight.async.callbacks.ValueCallback<ResultType> callback)
apply in interface delight.async.Operation<ResultType>public ResultType cachedResult()
PromiseIf this promises has been resolved, the result obtained will be returned by this function.
Otherwise, returns null.
cachedResult in interface Promise<ResultType>public ResultType get()
PromiseAttempts to resolve this promise synchronously.
get in interface Promise<ResultType>public void catchExceptions(delight.functional.Closure<Throwable> closure)
PromiseRegister a listener of exceptions.
catchExceptions in interface Promise<ResultType>closure - Closure to be called if an exception occurs in resolving the
promise.public void get(delight.functional.Closure<ResultType> closure)
PromiseAttempts to resolve this promise asynchronously.
get in interface Promise<ResultType>public void addExceptionFallback(delight.functional.Closure<Throwable> closure)
Promise
Registeres a listener for exceptions, which is triggered when no
listeners have been defined using Promise.catchExceptions(Closure)
addExceptionFallback in interface Promise<ResultType>Copyright © 2018. All rights reserved.