Package com.algorithmia.algo
Class AlgoFailure
- java.lang.Object
-
- com.algorithmia.algo.AlgoResponse
-
- com.algorithmia.algo.AlgoFailure
-
- All Implemented Interfaces:
java.io.Serializable
public final class AlgoFailure extends AlgoResponse
A result representing failure- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description AlgorithmExceptionerror
-
Constructor Summary
Constructors Constructor Description AlgoFailure(AlgorithmException error)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected <T> Tas(java.lang.Class<T> returnClass)Convert the result to a specific classprotected <T> Tas(java.lang.reflect.Type returnType)Convert the result to a specific typejava.lang.StringasJsonString()Return JSON representation of the result.java.lang.StringasString()Return String representation of the result.AlgoAsyncResponsegetAsyncResponse()MetadatagetMetadata()java.lang.StringgetRawOutput()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.booleanisFailure()booleanisSuccess()-
Methods inherited from class com.algorithmia.algo.AlgoResponse
as
-
-
-
-
Field Detail
-
error
public AlgorithmException error
-
-
Constructor Detail
-
AlgoFailure
public AlgoFailure(AlgorithmException error)
-
-
Method Detail
-
isSuccess
public boolean isSuccess()
- Specified by:
isSuccessin classAlgoResponse
-
isFailure
public boolean isFailure()
- Specified by:
isFailurein classAlgoResponse
-
getMetadata
public Metadata getMetadata() throws AlgorithmException
- Specified by:
getMetadatain classAlgoResponse- Throws:
AlgorithmException
-
getAsyncResponse
public AlgoAsyncResponse getAsyncResponse() throws AlgorithmException
- Specified by:
getAsyncResponsein classAlgoResponse- Throws:
AlgorithmException
-
as
protected <T> T as(java.lang.Class<T> returnClass) throws AlgorithmExceptionDescription copied from class:AlgoResponseConvert the result to a specific class- Specified by:
asin classAlgoResponse- Type Parameters:
T- the type that the response will be deserialized into- Parameters:
returnClass- the class used by the deserializer (should correspond with T)- Returns:
- the result, if this is AlgoSuccess
- Throws:
AlgorithmException- the error, if this is AlgoFailure
-
as
protected <T> T as(java.lang.reflect.Type returnType) throws AlgorithmExceptionDescription copied from class:AlgoResponseConvert the result to a specific type- Specified by:
asin classAlgoResponse- Type Parameters:
T- the type that the response will be deserialized into- Parameters:
returnType- the type used by the deserializer (should correspond with T)- Returns:
- the result, if this is AlgoSuccess
- Throws:
AlgorithmException- the error, if this is AlgoFailure
-
asJsonString
public java.lang.String asJsonString() throws AlgorithmExceptionDescription copied from class:AlgoResponseReturn JSON representation of the result.- Specified by:
asJsonStringin classAlgoResponse- Returns:
- the result, if this is AlgoSuccess
- Throws:
AlgorithmException- the error, if this is AlgoFailure
-
asString
public java.lang.String asString() throws AlgorithmExceptionDescription copied from class:AlgoResponseReturn String representation of the result.- Specified by:
asStringin classAlgoResponse- Returns:
- the result, if this is AlgoSuccess
- Throws:
AlgorithmException- the error, if this is AlgoFailure
-
getRawOutput
public java.lang.String getRawOutput() throws AlgorithmExceptionDescription copied from class:AlgoResponseReturn 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. Will return null for any other AlgorithmOutputType- Specified by:
getRawOutputin classAlgoResponse- Returns:
- the result, if this is AlgoSuccess
- Throws:
AlgorithmException- the error, if this is AlgoFailure
-
-