|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.gcube.common.core.utils.events.GCUBEEvent<T,P>
T - the type of the event topic.P - the type of the event payload.public class GCUBEEvent<T extends GCUBETopic,P>
A base implementation for events handled by GCUBEProducers and consumed by GCUBEConsumers.
An event is about a GCUBETopic, carries a payload, has a creation timestamp, and is handled by a producer.
Through type instantiation, events may be constrained to be about GCUBETopics and/or
carry given payloads. For example:
a GCUBEEvent<MyTopic,Object> is about a MyTopic but can carry any payload.
a GCUBEEvent<GCUBETopic,MyPayload> is about any GCUBETopic but carries
a MyPayload.
a GCUBEEvent<MyTopic,MyPayload> is about a MyTopic and carries
a MyPayload.
Type constraints may be specified when the event is created, e.g.:
GCUBEEvent<MyTopic,MyPayload> myEvent = new GCUBEEvent<MyTopic,MyPayload>();
or else by subclassing, e.g.
public class MyEvent extends GCUBEEvent<MyTopic,MyPayload> {...}
...
MyEvent myEvent = new MyEvent();
GCUBETopic,
GCUBEProducer,
GCUBEConsumer| Field Summary | |
|---|---|
protected P |
payload
The payload of the event. |
protected GCUBEProducer<? super T,? super P> |
producer
The producer of the event. |
protected Calendar |
timeStamp
The creation timestamp of the event. |
protected T |
topic
The topic of the event. |
| Constructor Summary | |
|---|---|
GCUBEEvent()
|
|
| Method Summary | |
|---|---|
P |
getPayload()
Returns the payload of the event. |
GCUBEProducer<? super T,? super P> |
getProducer()
Returns the producer which handled the event. |
Calendar |
getTimeStamp()
Returns the timestamp of the event. |
T |
getTopic()
Returns the topic of the event. |
boolean |
isExpired(Calendar time)
Indicates whether the event has expired at a given time (typically the current time). |
void |
setPayload(P payload)
Sets the payload of the event. |
protected void |
setProducer(GCUBEProducer<? super T,? super P> producer)
Sets the producer which handles the event. |
protected void |
setTopic(T topic)
Sets the topic of the event. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final Calendar timeStamp
protected T extends GCUBETopic topic
protected P payload
protected GCUBEProducer<? super T extends GCUBETopic,? super P> producer
| Constructor Detail |
|---|
public GCUBEEvent()
| Method Detail |
|---|
protected void setTopic(T topic)
topic - the topic.public T getTopic()
public P getPayload()
public void setPayload(P payload)
payload - public GCUBEProducer<? super T,? super P> getProducer()
protected void setProducer(GCUBEProducer<? super T,? super P> producer)
producer - the producer.public Calendar getTimeStamp()
public boolean isExpired(Calendar time)
time - the time.
true if it has, false otherwise.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||