public final class AlgoSuccess extends AlgoResponse
Constructor and Description |
---|
AlgoSuccess(com.google.gson.JsonElement result,
Metadata metadata,
java.lang.String rawOutput,
AlgoAsyncResponse asyncResponse) |
Modifier and Type | Method and Description |
---|---|
protected <T> T |
as(java.lang.Class<T> returnClass)
Convert the result to a specific class
|
protected <T> T |
as(java.lang.reflect.Type returnType)
Convert the result to a specific type
|
java.lang.String |
asJsonString()
Return JSON representation of the result.
|
java.lang.String |
asString()
Return String representation of the result.
|
AlgoAsyncResponse |
getAsyncResponse() |
Metadata |
getMetadata() |
java.lang.String |
getRawOutput()
Return the raw output of the algorithm if it was called with AlgorithmOutputType.RAW
This is the only valid way to retrieve a result from a RAW request.
|
boolean |
isFailure() |
boolean |
isSuccess() |
as
public AlgoSuccess(com.google.gson.JsonElement result, Metadata metadata, java.lang.String rawOutput, AlgoAsyncResponse asyncResponse)
public boolean isSuccess()
isSuccess
in class AlgoResponse
public boolean isFailure()
isFailure
in class AlgoResponse
public Metadata getMetadata()
getMetadata
in class AlgoResponse
public AlgoAsyncResponse getAsyncResponse() throws AlgorithmException
getAsyncResponse
in class AlgoResponse
AlgorithmException
protected <T> T as(java.lang.Class<T> returnClass)
AlgoResponse
as
in class AlgoResponse
T
- the type that the response will be deserialized intoreturnClass
- the class used by the deserializer (should correspond with T)protected <T> T as(java.lang.reflect.Type returnType)
AlgoResponse
as
in class AlgoResponse
T
- the type that the response will be deserialized intoreturnType
- the type used by the deserializer (should correspond with T)public java.lang.String asJsonString()
AlgoResponse
asJsonString
in class AlgoResponse
public java.lang.String asString()
AlgoResponse
asString
in class AlgoResponse
public java.lang.String getRawOutput() throws AlgorithmException
AlgoResponse
getRawOutput
in class AlgoResponse
AlgorithmException
- the error, if this is AlgoFailure