public abstract class BatchResult<T,E>
This class holds a single result of a batch call. The class is not thread-safe.
Type Parameters | |
---|---|
Name | Description |
T | |
E |
Constructors
BatchResult()
protected BatchResult()
Methods
completed()
public boolean completed()
Returns true
if the batch has been completed and the result is available; false
otherwise.
Returns | |
---|---|
Type | Description |
boolean |
error(E error)
protected void error(E error)
Sets an error and status as completed. Notifies all callbacks.
Parameter | |
---|---|
Name | Description |
error | E |
get()
public T get()
Returns the result of this call.
Returns | |
---|---|
Type | Description |
T |
Exceptions | |
---|---|
Type | Description |
E | if the batch has not been completed yet |
notify(BatchResult.Callback<T,E> callback)
public void notify(BatchResult.Callback<T,E> callback)
Adds a callback for the batch operation.
Parameter | |
---|---|
Name | Description |
callback | Callback<T,E> |
success(T result)
protected void success(T result)
Sets a result and status as completed. Notifies all callbacks.
Parameter | |
---|---|
Name | Description |
result | T |