@Immutable public class CommandRequestImpl<T> extends java.lang.Object implements CommandRequest<T>, TestableRequest
Constructor and Description |
---|
CommandRequestImpl(RequestHolder<T> requestHolder,
Command command,
org.codehaus.jackson.type.TypeReference<T> jsonParserTypeRef) |
CommandRequestImpl(RequestHolder<T> requestHolder,
Command command,
org.codehaus.jackson.type.TypeReference<T> jsonParserTypeRef,
com.google.common.base.Function<SphereBackendException,SphereException> transformError) |
Modifier and Type | Method and Description |
---|---|
T |
execute()
Executes the request and returns the result.
|
com.google.common.util.concurrent.ListenableFuture<SphereResult<T>> |
executeAsync()
Executes the request asynchronously and returns a future providing the result.
|
Command |
getCommand()
The command object that will be sent, for testing purposes.
|
TestableRequestHolder |
getRequestHolder()
Returns the internal request holder, for testing purposes.
|
java.lang.String |
toString() |
CommandRequest<T> |
withErrorHandling(com.google.common.base.Function<SphereBackendException,SphereException> transformError)
Transforms a generic error result from the Sphere backend into a specific error, depending on the use case.
|
public CommandRequestImpl(@Nonnull RequestHolder<T> requestHolder, @Nonnull Command command, @Nonnull org.codehaus.jackson.type.TypeReference<T> jsonParserTypeRef)
public CommandRequestImpl(@Nonnull RequestHolder<T> requestHolder, @Nonnull Command command, @Nonnull org.codehaus.jackson.type.TypeReference<T> jsonParserTypeRef, com.google.common.base.Function<SphereBackendException,SphereException> transformError)
public T execute()
CommandRequest
execute
in interface CommandRequest<T>
public com.google.common.util.concurrent.ListenableFuture<SphereResult<T>> executeAsync()
CommandRequest
executeAsync
in interface CommandRequest<T>
public CommandRequest<T> withErrorHandling(@Nonnull com.google.common.base.Function<SphereBackendException,SphereException> transformError)
CommandRequest
withErrorHandling
in interface CommandRequest<T>
public Command getCommand()
public TestableRequestHolder getRequestHolder()
TestableRequest
getRequestHolder
in interface TestableRequest
public java.lang.String toString()
toString
in class java.lang.Object