T
- the type of promised valuepublic interface Promise<T> extends SuccessPromise<T>
A promise allows what is to be done with the value to be specified without having the value available. They are a common alternative to callbacks in asynchronous programming.
To test code that uses promises, see the ratpack.test.exec.ExecHarness
class.
Modifier and Type | Method and Description |
---|---|
default void |
asResult(Action<? super Result<T>> resultHandler) |
SuccessPromise<T> |
onError(Action<? super Throwable> errorHandler)
Specifies the action to take if the an error occurs trying to produce the promised value.
|
void |
then(Action<? super T> then)
Specifies what should be done with the promised object when it becomes available.
|
SuccessPromise<T> onError(Action<? super Throwable> errorHandler)
errorHandler
- the action to take if an error occursvoid then(Action<? super T> then)
then
in interface SuccessPromise<T>
then
- the receiver of the promised value