Class AlgoSuccess

  • All Implemented Interfaces:
    java.io.Serializable

    public final class AlgoSuccess
    extends AlgoResponse
    A result representing success, depending on how the algorithm was called it may have an async response, rawOutput, or metadata + result.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      AlgoSuccess​(com.google.gson.JsonElement result, Metadata metadata, java.lang.String rawOutput, AlgoAsyncResponse asyncResponse)  
    • 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 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()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AlgoSuccess

        public AlgoSuccess​(com.google.gson.JsonElement result,
                           Metadata metadata,
                           java.lang.String rawOutput,
                           AlgoAsyncResponse asyncResponse)
    • Method Detail

      • as

        protected <T> T as​(java.lang.Class<T> returnClass)
        Description copied from class: AlgoResponse
        Convert the result to a specific class
        Specified by:
        as in class AlgoResponse
        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
      • as

        protected <T> T as​(java.lang.reflect.Type returnType)
        Description copied from class: AlgoResponse
        Convert the result to a specific type
        Specified by:
        as in class AlgoResponse
        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
      • asJsonString

        public java.lang.String asJsonString()
        Description copied from class: AlgoResponse
        Return JSON representation of the result.
        Specified by:
        asJsonString in class AlgoResponse
        Returns:
        the result, if this is AlgoSuccess
      • asString

        public java.lang.String asString()
        Description copied from class: AlgoResponse
        Return String representation of the result.
        Specified by:
        asString in class AlgoResponse
        Returns:
        the result, if this is AlgoSuccess
      • 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 class AlgoResponse
        Returns:
        the result, if this is AlgoSuccess
        Throws:
        AlgorithmException - the error, if this is AlgoFailure