Package com.google.cloud
Class BatchResult<T,E extends BaseServiceException>
- java.lang.Object
-
- com.google.cloud.BatchResult<T,E>
-
- Type Parameters:
T- the type of the resultE- the type of the service-dependent exception thrown when a processing error occurs
public abstract class BatchResult<T,E extends BaseServiceException> extends Object
This class holds a single result of a batch call. The class is not thread-safe.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceBatchResult.Callback<T,E>An interface for the batch callbacks.
-
Constructor Summary
Constructors Modifier Constructor Description protectedBatchResult()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancompleted()Returnstrueif the batch has been completed and the result is available;falseotherwise.protected voiderror(E error)Sets an error and status as completed.Tget()Returns the result of this call.voidnotify(BatchResult.Callback<T,E> callback)Adds a callback for the batch operation.protected voidsuccess(T result)Sets a result and status as completed.
-
-
-
Constructor Detail
-
BatchResult
@InternalApi("This class should only be extended within google-cloud-java") protected BatchResult()
-
-
Method Detail
-
completed
public boolean completed()
Returnstrueif the batch has been completed and the result is available;falseotherwise.
-
get
public T get() throws E extends BaseServiceException
Returns the result of this call.- Throws:
IllegalStateException- if the batch has not been completed yetE- if an error occurred when processing the batch requestE extends BaseServiceException
-
notify
public void notify(BatchResult.Callback<T,E> callback)
Adds a callback for the batch operation.- Throws:
IllegalStateException- if the batch has been completed already
-
error
protected void error(E error)
Sets an error and status as completed. Notifies all callbacks.
-
success
protected void success(T result)
Sets a result and status as completed. Notifies all callbacks.
-
-