Class ResponseImpl<C extends AbstractConnector<?>>

java.lang.Object
org.scictrl.csshell.ResponseImpl<C>
Type Parameters:
C - connector implementation
All Implemented Interfaces:
Response<C>

public class ResponseImpl<C extends AbstractConnector<?>> extends Object implements Response<C>
Default response implementation
Author:
igor@scictrl.com
  • Constructor Details

    • ResponseImpl

      public ResponseImpl(Connection<C,?,?> source, Request<C> r, Object tag, boolean success, Exception error, Poop<?,?> poop, boolean last)
      Creates a new ResponseImpl object.
      Parameters:
      source - response source
      r - the request this response is the response of
      tag - a Object object
      success - true if response is a success
      error - response error
      poop - a Poop object
      last - true if this is the last response.
  • Method Details

    • getError

      public Exception getError()
      If result of the request is an error this method will return it. Otherwise it will return null
      Specified by:
      getError in interface Response<C extends AbstractConnector<?>>
      Returns:
      error
    • getRequest

      public Request<C> getRequest()
      Returns Request object, which initiated this response.
      Specified by:
      getRequest in interface Response<C extends AbstractConnector<?>>
      Returns:
      initial Request
    • getTag

      public Object getTag()
      Optional identification tag of the response. Interpretation depends on asynchronus methods which generated this response.
      Specified by:
      getTag in interface Response<C extends AbstractConnector<?>>
      Returns:
      identification tag.
    • isLast

      public boolean isLast()
      Returns true if this is last response in series of responses.
      Specified by:
      isLast in interface Response<C extends AbstractConnector<?>>
      Returns:
      true if it is last response
    • getConnection

      public Connection<C,?,?> getConnection()
      Returns the source of the response, same as in associated Request.
      Specified by:
      getConnection in interface Response<C extends AbstractConnector<?>>
      Returns:
      response source
    • getPoop

      public Poop<?,?> getPoop()
      Returns the condition of the response
      Specified by:
      getPoop in interface Response<C extends AbstractConnector<?>>
      Returns:
      response condition
    • isSuccess

      public boolean isSuccess()
      Returns true if the request was successfully completed.
      Specified by:
      isSuccess in interface Response<C extends AbstractConnector<?>>
      Returns:
      returns true if response is a success
    • toString

      public String toString()
      Overrides:
      toString in class Object