com.salesforce.android.service.common.utilities.control.Async<T> |
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
interface | Async.CancellationHandler | ||||||||||
interface | Async.CompletionHandler | ||||||||||
interface | Async.ErrorHandler | ||||||||||
interface | Async.Handler<T> | ||||||||||
interface | Async.ResultHandler<T> |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
abstract <S extends ResultHandler<? super T> & Async.ErrorHandler & Async.CompletionHandler> Async<T> |
addHandler(S handler)
Convenience method for adding a handler that is both a ResultHandler and an ErrorHandler.
| ||||||||||
abstract void |
cancel()
Cancel the operation.
| ||||||||||
abstract <S> Async<S> |
chain(Function<? super T, ? extends Async<? extends S>> mapFunction)
Creates a new Async that maps the result of this async to another async with a different type.
| ||||||||||
abstract boolean |
hasFailed()
Checks if the operation has encountered an error.
| ||||||||||
abstract boolean |
inProgress()
Checks whether this operation is still in progress.
| ||||||||||
abstract boolean |
isCancelled()
Check if the operation has been cancelled.
| ||||||||||
abstract boolean |
isComplete()
Checks if the operation has completed succesfully.
| ||||||||||
abstract <S> Async<S> |
map(Function<? super T, ? extends S> mapFunction)
Creates a new Async that maps the result of this async to a different type.
| ||||||||||
abstract Async<T> |
onCancelled(Async.CancellationHandler handler)
Adds a handler that will be invoked when the operation is cancelled.
| ||||||||||
abstract Async<T> |
onComplete(Async.CompletionHandler handler)
Adds a handler that will be invoked when the operation completes successfully.
| ||||||||||
abstract Async<T> |
onError(Async.ErrorHandler handler)
Adds a handler that will be invoked if the operation ends in an error.
| ||||||||||
abstract Async<T> |
onResult(ResultHandler<? super T> handler)
Adds a handler to receive a result from this operation.
| ||||||||||
abstract Async<T> |
pipe(ResultReceiver<? super T> receiver)
Pipe the output from this Async to the input for a ResultReceiver.
| ||||||||||
abstract Async<T> |
removeCancellationHandler(Async.CancellationHandler handler)
Removes a single cancellation handler.
| ||||||||||
abstract Async<T> |
removeCompletionHandler(Async.CompletionHandler handler)
Removes a single completion handler.
| ||||||||||
abstract Async<T> |
removeErrorHandler(Async.ErrorHandler handler)
Removes a single error handler.
| ||||||||||
abstract <S extends ResultHandler<? super T> & Async.ErrorHandler & Async.CompletionHandler> Async<T> |
removeHandler(S handler)
Convenience method for removing something as both a result and error handler at once.
| ||||||||||
abstract Async<T> |
removeResultHandler(ResultHandler<? super T> handler)
Removes a single consumer.
|
Convenience method for adding a handler that is both a ResultHandler and an ErrorHandler. This
call is the same as operation.onResult(handler).onError(handler)
.
handler | The handler to add. |
---|
Cancel the operation. No handlers will be invoked after cancel is called.
Creates a new Async that maps the result of this async to another async with a different type.
mapFunction | The function that maps the type |
---|
Checks if the operation has encountered an error.
Checks whether this operation is still in progress.
Check if the operation has been cancelled.
Checks if the operation has completed succesfully.
Creates a new Async that maps the result of this async to a different type.
mapFunction | The function that maps the type. |
---|
Adds a handler that will be invoked when the operation is cancelled.
Adds a handler that will be invoked when the operation completes successfully.
Adds a handler that will be invoked if the operation ends in an error. If the operation has already ended in an error the handler will be called synchronously with the error. If the operation is cancelled or completes successfully the handler will not be called. Otherwise, the handler will be called when the error is encountered.
handler | The handler to add. |
---|
Adds a handler to receive a result from this operation. If the operation is already complete the handler will be called synchronously with the result. If the operation is cancelled or ends in an error the handler will not be called. Otherwise, the handler will be called when the result is available.
handler | The handler to add. |
---|
Pipe the output from this Async to the input for a ResultReceiver. Any errors/results/completes that occur for this instance will be propagated to the passed ResultReceiver.
receiver | The ResultReceiver to which to pipe the results. |
---|
Removes a single cancellation handler. The operation will continue and other cancellation handlers may be notified.
Removes a single completion handler. The operation will continue and other completion handlers may be notified.
Removes a single error handler. The operation will continue and other consumers may still receive a result.
handler | The ErrorHandler instance to remove. |
---|
Convenience method for removing something as both a result and error handler at once. This call
is the same as operation.removeResultHandler(handler).removeErrorHandler(handler)
.
handler | The handler instance to remove. |
---|
Removes a single consumer. The operation will continue and other consumers may still receive a result.
handler | The ResultHandler instance to remove. |
---|