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 AlgorithmException
error
-
Constructor Summary
Constructors Constructor Description AlgoFailure(AlgorithmException error)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected <T> T
as(java.lang.Class<T> returnClass)
Convert the result to a specific classprotected <T> T
as(java.lang.reflect.Type returnType)
Convert the result to a specific typejava.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()
-
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:
isSuccess
in classAlgoResponse
-
isFailure
public boolean isFailure()
- Specified by:
isFailure
in classAlgoResponse
-
getMetadata
public Metadata getMetadata() throws AlgorithmException
- Specified by:
getMetadata
in classAlgoResponse
- Throws:
AlgorithmException
-
getAsyncResponse
public AlgoAsyncResponse getAsyncResponse() throws AlgorithmException
- Specified by:
getAsyncResponse
in classAlgoResponse
- Throws:
AlgorithmException
-
as
protected <T> T as(java.lang.Class<T> returnClass) throws AlgorithmException
Description copied from class:AlgoResponse
Convert the result to a specific class- Specified by:
as
in 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 AlgorithmException
Description copied from class:AlgoResponse
Convert the result to a specific type- Specified by:
as
in 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 AlgorithmException
Description copied from class:AlgoResponse
Return JSON representation of the result.- Specified by:
asJsonString
in classAlgoResponse
- Returns:
- the result, if this is AlgoSuccess
- Throws:
AlgorithmException
- the error, if this is AlgoFailure
-
asString
public java.lang.String asString() throws AlgorithmException
Description copied from class:AlgoResponse
Return String representation of the result.- Specified by:
asString
in classAlgoResponse
- Returns:
- the result, if this is AlgoSuccess
- Throws:
AlgorithmException
- the error, if this is AlgoFailure
-
getRawOutput
public java.lang.String getRawOutput() throws AlgorithmException
Description copied from class:AlgoResponse
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. Will return null for any other AlgorithmOutputType- Specified by:
getRawOutput
in classAlgoResponse
- Returns:
- the result, if this is AlgoSuccess
- Throws:
AlgorithmException
- the error, if this is AlgoFailure
-
-