Class Event


public class Event extends EventObject
Superclass of all events that may be fired during the life of J2SSH.

All events have the following attributes in common :-

  • Event code. This is an int and must be unique across the whole of J2SSH.
  • State. A boolean specifying whether the event is the result of a successful operation or a failed one.

  • Constructor Details

    • Event

      public Event(Object source, int id, boolean state)
      Parameters:
      source - source of event
      id - event code
      boolean - state true=successful false=unsuccessful
    • Event

      public Event(Object source, int id, Throwable error)
  • Method Details

    • getId

      public int getId()
      Get the unique event id
      Returns:
      unique event id
    • getState

      public boolean getState()
      Get the event state. May be one of #STATE_SUCCESSFUL or #STATE_UNSUCCESSFUL.
      Returns:
      event state
    • getAttribute

      public Object getAttribute(String key)
      Get the value of an event attribute
      Parameters:
      key - key of event
      Returns:
      value
    • getAllAttributes

      public String getAllAttributes()
    • logAttributes

      public String logAttributes()
    • addAttribute

      public Event addAttribute(String key, Object value)
      Add an attribute to the event
      Parameters:
      key - key of attribute
      String - value of attribute
      Returns:
      this object, to allow event attribute chains