public class Event
extends java.lang.Object
Constructor and Description |
---|
Event()
Construct empty event.
|
Event(java.lang.Class<?> type) |
Event(Scope scope,
java.lang.Class<?> type,
java.lang.Object data)
Creates a new event that can be send to scope.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addCause(EventId id)
Adds the id of one event to the causes of this event.
|
boolean |
equals(java.lang.Object obj) |
java.util.Set<EventId> |
getCauses()
Returns all causing events marked so far.
|
java.lang.Object |
getData() |
EventId |
getId() |
MetaData |
getMetaData()
Returns a
MetaData instance representing the meta data for this
event. |
java.lang.String |
getMethod() |
Scope |
getScope() |
ParticipantId |
getSenderId()
Deprecated.
use
getId() instead |
long |
getSequenceNumber()
Deprecated.
use
getId() instead |
java.lang.Class<?> |
getType() |
int |
hashCode() |
boolean |
isCause(EventId id)
Tells whether the id of one event is already marked as a cause of this
event.
|
boolean |
removeCause(EventId id)
Removes a causing event from the set of causes for this event.
|
void |
setData(java.lang.Object data) |
void |
setId(EventId id)
Sets the id of this event.
|
void |
setId(ParticipantId senderId,
long sequenceNumber)
Sets all information necessary to generate the
EventId of this
event. |
void |
setMethod(java.lang.String method) |
void |
setScope(Scope scope) |
void |
setType(java.lang.Class<?> type) |
java.lang.String |
toString() |
public Event(Scope scope, java.lang.Class<?> type, java.lang.Object data)
scope
- The scope to which the event will be sent.type
- A class object indicating the class of the data
being sent in the event.data
- The actual data that should be sent in the
event.public Event(java.lang.Class<?> type)
public Event()
public java.lang.Class<?> getType()
null
to express
a void type where no payload is carried at all.public void setType(java.lang.Class<?> type)
type
- the Java type to set for the Event payloadpublic java.lang.Object getData()
public void setData(java.lang.Object data)
data
- the data to setpublic Scope getScope()
public void setId(ParticipantId senderId, long sequenceNumber)
EventId
of this
event. After this call getId()
is able to return an id.senderId
- id of the sending participant for this eventsequenceNumber
- sequence number within the specified participantpublic void setId(EventId id)
getId()
can return an id.id
- new id to setpublic ParticipantId getSenderId()
getId()
insteadjava.lang.IllegalStateException
- the id is not yet defined because the event was not sent by
an Informer
so farpublic void setScope(Scope scope)
scope
- the scope to setpublic long getSequenceNumber()
getId()
insteadjava.lang.IllegalStateException
- the id is not yet defined because the event was not sent by
an Informer
so farpublic EventId getId()
public MetaData getMetaData()
MetaData
instance representing the meta data for this
event.null
public java.lang.String getMethod()
public void setMethod(java.lang.String method)
method
- the method to setpublic java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public boolean addCause(EventId id)
id
- the id of a causing eventtrue
if the causes was added, false
if
it already existedpublic boolean removeCause(EventId id)
id
- of the causing eventtrue
if an event with this id was removed from the
causes, else false
public boolean isCause(EventId id)
id
- id of the event to test causality fortrue
if id is marked as a cause for this event, else
false
public java.util.Set<EventId> getCauses()