Interface Caller

  • All Implemented Interfaces:

    
    public interface Caller<TResponse extends Object>
    
                        

    An invocation of a method that sends a request to a webserver and returns a response. Each caller yields its own HTTP request and response pair.

    Callers may be executed synchronously with execute, or asynchronously with enqueue.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      public interface Caller.Callback

      the callback type to notify the result of this caller.

    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Constructor Detail

    • Method Detail

      • isExecuted

         abstract Boolean isExecuted()

        Returns true if this caller has been either execute executed or enqueue enqueued. It is an error to execute or enqueue a caller more than once.

      • execute

         abstract Response<TResponse> execute()

        Synchronously send the request and return its response

        Returns:

        the response

      • enqueue

         abstract Unit enqueue(Caller.Callback<TResponse> callback)

        Asynchronously send the request and notify Callback of its response or if an error occurred talking to the server, creating the request, or processing the response

        Parameters:
        callback - the callback that notify of its successful response or error