public class Event
extends java.util.EventObject
As an example, a "submit" event might signal that a Submit button was pressed in a web browser. A "success" event might signal an action executed successfully. A "finish" event might signal a subflow ended normally.
Why is this not an interface? A specific design choice. An event is not a strategy that defines a generic type or role--it is essentially an immutable value object. It is expected that specializations of this base class be "Events" and not part of some other inheritance hierarchy.
Constructor and Description |
---|
Event(java.lang.Object source,
java.lang.String id)
Create a new event with the specified
id and no payload. |
Event(java.lang.Object source,
java.lang.String id,
AttributeMap<java.lang.Object> attributes)
Create a new event with the specified
id and payload attributes. |
Modifier and Type | Method and Description |
---|---|
AttributeMap<java.lang.Object> |
getAttributes()
Returns an unmodifiable map storing the attributes of this event.
|
java.lang.String |
getId()
Returns the event identifier.
|
long |
getTimestamp()
Returns the time at which the event occurred, represented as the number of milliseconds since January 1, 1970,
00:00:00 GMT.
|
java.lang.String |
toString() |
public Event(java.lang.Object source, java.lang.String id)
id
and no payload.source
- the source of the event (required)id
- the event identifier (required)public Event(java.lang.Object source, java.lang.String id, AttributeMap<java.lang.Object> attributes)
id
and payload attributes.source
- the source of the event (required)id
- the event identifier (required)attributes
- additional event attributespublic java.lang.String getId()
public long getTimestamp()
public AttributeMap<java.lang.Object> getAttributes()
null
.public java.lang.String toString()
toString
in class java.util.EventObject