|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.electrocodeogram.cpc.core.api.hub.event.CPCEvent
public abstract class CPCEvent
Abstract parent class for all types of CPC Events. This is the root of the event class hierarchy.
Comparability is defined based on the creation time of an event object.
Creation times are guaranteed to be unique.
Constructor Summary | |
---|---|
CPCEvent()
Creates a new CPCEvent instance with a unique creation time. |
Method Summary | |
---|---|
protected void |
checkSeal()
Ensures that this event has not yet been sealed. |
protected java.lang.Object |
clone()
|
int |
compareTo(CPCEvent o)
|
long |
getCreationTime()
Retrieves the creation time of this event in milliseconds. |
boolean |
isValid()
Checks if this event has been fully initialised. |
void |
seal()
Marks this event as sealed. |
abstract java.lang.String |
toString()
Every event should implement a sensible toString method for use in debugging log messages. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public CPCEvent()
CPCEvent
instance with a unique creation time.
Method Detail |
---|
public void seal()
IMPORTANT: An event is always sealed by the IEventHubRegistry
once the
event is being dispatched. The creator of the event, must not call this method.
Trying to modify a sealed event will throw an IllegalStateException.
Subclasses may override this method but must ensure that they call it in their new seal() implementation.
protected void checkSeal()
java.lang.IllegalStateException
- if the event was already sealed.public long getCreationTime()
System.currentTimeMillis()
at the time of
the creation of the event object.
Creation times are guaranteed to be unique. Equality and comparability are based on event creation times.
protected java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
public boolean isValid()
Subclasses should override this method but should never return true. Instead they should delegate to the super class implementation once all validity checks on their level have passed.
The isValid()
implementation always returns true.
IEventHubRegistry.dispatch(CPCEvent)
public int compareTo(CPCEvent o)
compareTo
in interface java.lang.Comparable<CPCEvent>
public abstract java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |