Class ResponseEvent<C extends AbstractConnector<?>>

java.lang.Object
java.util.EventObject
org.scictrl.csshell.ResponseEvent<C>
Type Parameters:
C - connector implementation
All Implemented Interfaces:
Serializable

public class ResponseEvent<C extends AbstractConnector<?>> extends EventObject
A base class for events used in asynchronous mode notifications. Whenever a class declares the AsynchronousAccess interface, it must provide listener registration and deregistration methods for ResponseListeenrs to which events of this type are delivered. These events contain the reference to the request object for which they are being dispatched, along with the associated response that is being deliverd by this event notification.

This class must be subclassed to have its abstract method implemented; in addition, the subtype may provide additional access to the containing request / response pair or other functions specific to the underlying implementation.

Author:
igor@scictrl.com
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected Request<C>
    Variable holding a reference to the request object.
    protected Response<C>
    Variable holding a reference to the response object.

    Fields inherited from class java.util.EventObject

    source
  • Constructor Summary

    Constructors
    Constructor
    Description
    ResponseEvent(Object source, Request<C> req, Response<C> res)
    Creates a new instance of the event, by specifying the AsynchronousAccess source that generated the event and the request object which caused the notification to occur.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the request specified as a constructor parameter.
    Implementations of this method must return the response object that is causing this notification to be delivered.
    boolean
    Returns true if this event is the last event in the series.
    boolean
    isSuccess.

    Methods inherited from class java.util.EventObject

    getSource, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • request

      protected Request<C extends AbstractConnector<?>> request
      Variable holding a reference to the request object. The request contained by this field is the request for which a new response is being delivered.
    • response

      protected Response<C extends AbstractConnector<?>> response
      Variable holding a reference to the response object.
  • Constructor Details

    • ResponseEvent

      public ResponseEvent(Object source, Request<C> req, Response<C> res)
      Creates a new instance of the event, by specifying the AsynchronousAccess source that generated the event and the request object which caused the notification to occur.
      Parameters:
      source - the source firing the event
      req - request the status of which has changed
      res - a Response object
  • Method Details

    • getRequest

      public Request<C> getRequest()
      Returns the request specified as a constructor parameter. This event instance is delivering a response for the request returned by this method.
      Returns:
      Object the request object
    • getResponse

      public Response<C> getResponse()
      Implementations of this method must return the response object that is causing this notification to be delivered. The response object should contain the reason for this event, for example new value delivered, timeout, error, successful completion etc.
      Returns:
      Object the response object that is causing this event
    • isLast

      public boolean isLast()
      Returns true if this event is the last event in the series. In other words, true indicates that no more events are forthcoming from the given request.
      Returns:
      true if no more events will be delivered for the request contained in this event
    • isSuccess

      public boolean isSuccess()

      isSuccess.

      Returns:
      a boolean