Package com.vmware.vapi.util.async
Class DecoratorAsyncHandle<T>
- java.lang.Object
-
- com.vmware.vapi.core.AsyncHandle<T>
-
- com.vmware.vapi.util.async.DecoratorAsyncHandle<T>
-
- Type Parameters:
T
- result type of the async handle
public class DecoratorAsyncHandle<T> extends AsyncHandle<T>
Utility which decorates an existing async handle. Use as a base class and override just the methods you need to save some boilerplate.
-
-
Field Summary
Fields Modifier and Type Field Description protected AsyncHandle<T>
decorated
-
Constructor Summary
Constructors Constructor Description DecoratorAsyncHandle(AsyncHandle<T> decorated)
Creates a decorator around the specified handle.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
setError(java.lang.RuntimeException error)
Completes the invocation with an error.void
setResult(T result)
Completes the invocation with an output value.void
updateProgress(DataValue progress)
Reports progress for the operation invocation.
-
-
-
Field Detail
-
decorated
protected final AsyncHandle<T> decorated
-
-
Constructor Detail
-
DecoratorAsyncHandle
public DecoratorAsyncHandle(AsyncHandle<T> decorated)
Creates a decorator around the specified handle.- Parameters:
decorated
- handle to be decorated; must not be null.
-
-
Method Detail
-
updateProgress
public void updateProgress(DataValue progress)
Description copied from class:AsyncHandle
Reports progress for the operation invocation. May be invoked multiple times.- Specified by:
updateProgress
in classAsyncHandle<T>
- Parameters:
progress
- progress status of the operation invocation
-
setResult
public void setResult(T result)
Description copied from class:AsyncHandle
Completes the invocation with an output value. Must not be called after the operation is already completed (with either an output or an error).- Specified by:
setResult
in classAsyncHandle<T>
- Parameters:
result
- operation output
-
setError
public void setError(java.lang.RuntimeException error)
Description copied from class:AsyncHandle
Completes the invocation with an error. Must not be called after the operation is already completed (with either an output or an error).- Specified by:
setError
in classAsyncHandle<T>
- Parameters:
error
- operation error
-
-