|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.util.EventObject i3.dragos.core.services.events.DragosEvent
public abstract class DragosEvent
Abstract super class for all events used in DRAGOS.
Events are used to communicate with different parts of the system. Each event has been created by some other
component which is called the source. Most event classes can signal multiple types of events, which are
defined as integer constants and returned by getEventType()
. [We wanted to use enums for this, but they are
not suitable for cases like these where subclasses will be added by multiple independent parties in independent
projects.] Make sure to verify the events class using getEventClass()
before interpreting the type values,
because subclasses might define other constants with the same value, but a completely different meaning! Only the
pair (getEventClass(), getEventType()) will always uniquely identify the event.
Subclasses should provide a constructor that accepts any eventType argument, even if they only encapsulate a single type of event, so that further subclasses can be created. Beyond that, getters for any additional attributes should obviously defined as well.
Field Summary |
---|
Fields inherited from class java.util.EventObject |
---|
source |
Constructor Summary | |
---|---|
DragosEvent(java.lang.Object source,
int eventType)
Creates a new event. |
Method Summary | |
---|---|
java.lang.String |
getEventClass()
Returns the name of the event class. |
int |
getEventType()
Returns the type of the event. |
java.lang.String |
toString()
|
Methods inherited from class java.util.EventObject |
---|
getSource |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public DragosEvent(java.lang.Object source, int eventType)
source
- The source of this event.eventType
- The type of event.Method Detail |
---|
public final java.lang.String getEventClass()
return getClass().getName();
public int getEventType()
public java.lang.String toString()
toString
in class java.util.EventObject
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |