|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.axonframework.domain.GenericMessage<T> org.axonframework.domain.GenericEventMessage<T>
T
- The type of payload contained in this Messagepublic class GenericEventMessage<T>
Generic implementation of the EventMessage interface. It simply keeps a reference to the payload and MetaData.
Constructor Summary | |
---|---|
GenericEventMessage(String identifier,
org.joda.time.DateTime timestamp,
T payload,
Map<String,?> metaData)
Constructor to reconstruct an EventMessage using existing data. |
|
GenericEventMessage(T payload)
Creates a GenericEventMessage with given payload , and an empty MetaData. |
|
GenericEventMessage(T payload,
Map<String,?> metaData)
Creates a GenericEventMessage with given payload and given metaData . |
Method Summary | ||
---|---|---|
GenericEventMessage<T> |
andMetaData(Map<String,?> additionalMetaData)
Returns a copy of this Message with it MetaData merged with the given metaData . |
|
static
|
asEventMessage(Object event)
Returns the given event as an EventMessage. |
|
org.joda.time.DateTime |
getTimestamp()
Returns the timestamp of this event. |
|
String |
toString()
|
|
GenericEventMessage<T> |
withMetaData(Map<String,?> newMetaData)
Returns a copy of this Message with the given metaData . |
Methods inherited from class org.axonframework.domain.GenericMessage |
---|
getIdentifier, getMetaData, getPayload, getPayloadType |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.axonframework.domain.EventMessage |
---|
getIdentifier |
Methods inherited from interface org.axonframework.domain.Message |
---|
getMetaData, getPayload, getPayloadType |
Constructor Detail |
---|
public GenericEventMessage(T payload)
payload
, and an empty MetaData.
payload
- The payload for the messageasEventMessage(Object)
public GenericEventMessage(T payload, Map<String,?> metaData)
payload
and given metaData
.
payload
- The payload of the EventMessagemetaData
- The MetaData for the EventMessageasEventMessage(Object)
public GenericEventMessage(String identifier, org.joda.time.DateTime timestamp, T payload, Map<String,?> metaData)
identifier
- The identifier of the Messagetimestamp
- The timestamp of the Message creationpayload
- The payload of the messagemetaData
- The meta data of the messageMethod Detail |
---|
public static <T> EventMessage<T> asEventMessage(Object event)
event
already implements EventMessage, it is
returned as-is. If it is a Message, a new EventMessage will be created using the payload and meta data of the
given message. Otherwise, the given event
is wrapped into a GenericEventMessage as its payload.
T
- The generic type of the expected payload of the resulting objectevent
- the event to wrap as EventMessage
event
as payload, or event
if it already
implements EventMessage.public org.joda.time.DateTime getTimestamp()
EventMessage
getTimestamp
in interface EventMessage<T>
public GenericEventMessage<T> withMetaData(Map<String,?> newMetaData)
Message
metaData
. The payload remains unchanged.
While the implementation returned may be different than the implementation of this
, implementations
must take special care in returning the same type of Message (e.g. EventMessage, DomainEventMessage) to prevent
errors further downstream.
withMetaData
in interface EventMessage<T>
withMetaData
in interface Message<T>
withMetaData
in class GenericMessage<T>
newMetaData
- The new MetaData for the Message
public GenericEventMessage<T> andMetaData(Map<String,?> additionalMetaData)
Message
metaData
. The payload
remains unchanged.
andMetaData
in interface EventMessage<T>
andMetaData
in interface Message<T>
andMetaData
in class GenericMessage<T>
additionalMetaData
- The MetaData to merge with
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |