public interface AsyncResult<T>
Many operations in Vert.x APIs provide results back by passing an instance of this in a Handler
.
The result can either have failed or succeeded.
If it failed then the cause of the failure is available with cause()
.
If it succeeded then the actual result is available with result()
Modifier and Type | Method and Description |
---|---|
Throwable |
cause()
A Throwable describing failure.
|
boolean |
failed()
Did it fail?
|
default <U> AsyncResult<U> |
map(Function<T,U> mapper)
Apply a
mapper function on this async result. |
default <V> AsyncResult<V> |
map(V value)
Map the result of this async result to a specific
value . |
T |
result()
The result of the operation.
|
boolean |
succeeded()
Did it succeed?
|
T result()
Throwable cause()
boolean succeeded()
boolean failed()
default <U> AsyncResult<U> map(Function<T,U> mapper)
mapper
function on this async result.
The mapper
is called with the completed value and this mapper returns a value. This value will complete the result returned by this method call.
If the mapper
throws an exception, the returned future will be failed with this exception.
When this async result is failed, the failure will be propagated to the returned future and the mapper
will not be called.
mapper
- the mapper functiondefault <V> AsyncResult<V> map(V value)
value
.
When this async result succeeds, this value
will succeeeds the async result returned by this method call.
When this future fails, the failure will be propagated to the returned async result.
value
- the value that eventually completes the mapped async resultCopyright © 2017. All rights reserved.