T
- the generic type (the sub class type) of the event sourcepublic class ActEvent<T>
extends java.util.EventObject
An ActEvent
is a generic version of EventObject
Modifier and Type | Field and Description |
---|---|
protected static java.lang.Object |
SOURCE_PLACEHODER |
Modifier | Constructor and Description |
---|---|
protected |
ActEvent()
This constructor allows sub class to construct a Self source event, e.g.
|
|
ActEvent(T source)
Construct an
ActEvent with source instance |
Modifier and Type | Method and Description |
---|---|
java.lang.Class<? extends ActEvent<T>> |
eventType()
Unlike the
Object.getClass() method, which always return the java class of the current instance. |
T |
source() |
long |
timestamp()
Return the timestamp of the event
|
protected ActEvent()
This constructor allows sub class to construct a Self source event, e.g. the source can be the event instance itself.
Note if sub class needs to use this constructor the EventObject.getSource()
()} method must be overwritten
public ActEvent(T source)
Construct an ActEvent
with source instance
source
- The object on which the Event initially occurred. or any payload the developer want to attach to the eventpublic java.lang.Class<? extends ActEvent<T>> eventType()
Unlike the Object.getClass()
method, which always return the java class of the current instance. This eventType()
method allow a certain implementation of the class terminate the return value of the method. For example, suppose you have a event class MyEvent
and you might have some anonymous class of MyEvent
. If you implement the eventType()
of MyEvent
class as follows:
public class<MyEvent> eventType() { return MyEvent.class; }Then all the anonymous sub class will return the
MyEvent.class
instead of their own class. This allows the ActFramework properly handle the event class registration
public final T source()
public final long timestamp()
Return the timestamp of the event
System.currentTimeMillis()
Copyright © 2014–2017 ActFramework. All rights reserved.