|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.axonframework.serializer.SerializedDomainEventMessage<T>
T
- The type of payload contained in this messagepublic class SerializedDomainEventMessage<T>
DomainEventMessage implementation that is optimized to cope with serialized Payload and MetaData. The Payload and MetaData will only be deserialized when requested. This means that loaded event for which there is no handler will never be deserialized.
This implementation is Serializable as per Java specification. Both MetaData and Payload are deserialized prior to being written to the OutputStream.
Constructor Summary | |
---|---|
SerializedDomainEventMessage(SerializedDomainEventData domainEventData,
Serializer serializer)
Reconstructs a DomainEventMessage using the given domainEventData , containing data to be
deserialized using the given serializer . |
|
SerializedDomainEventMessage(SerializedEventMessage<T> eventMessage,
Object aggregateIdentifier,
long sequenceNumber)
Wrapper constructor for wrapping a SerializedEventMessage as a SerializedDomainEventMessage, using given aggregateIdentifier and sequenceNumber . |
Method Summary | ||
---|---|---|
DomainEventMessage<T> |
andMetaData(Map<String,?> additionalMetaData)
Returns a copy of this DomainEventMessage with its MetaData merged with the given metaData . |
|
Object |
getAggregateIdentifier()
Returns the identifier of the Aggregate that generated this DomainEvent. |
|
String |
getIdentifier()
Returns the identifier of this event. |
|
MetaData |
getMetaData()
Returns the meta data for this event. |
|
T |
getPayload()
Returns the payload of this Event. |
|
Class |
getPayloadType()
Returns the type of the payload. |
|
long |
getSequenceNumber()
Returns the sequence number that allows DomainEvents originating from the same Aggregate to be placed in the order of generation. |
|
org.joda.time.DateTime |
getTimestamp()
Returns the timestamp of this event. |
|
boolean |
isPayloadDeserialized()
Indicates whether the payload of this message has already been deserialized. |
|
|
serializeMetaData(Serializer serializer,
Class<R> expectedRepresentation)
Serialize the meta data of this message using given serializer , using given
expectedRepresentation . |
|
|
serializePayload(Serializer serializer,
Class<R> expectedRepresentation)
Serialize the payload of this message using given serializer , using given
expectedRepresentation . |
|
DomainEventMessage<T> |
withMetaData(Map<String,?> newMetaData)
Returns a copy of this DomainEventMessage with the given metaData . |
|
protected Object |
writeReplace()
Java Serialization API Method that provides a replacement to serialize, as the fields contained in this instance are not serializable themselves. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SerializedDomainEventMessage(SerializedDomainEventData domainEventData, Serializer serializer)
domainEventData
, containing data to be
deserialized using the given serializer
. The serialized data is deserialized on-demand.
domainEventData
- The SerializedDomainEventData providing access to this message's dataserializer
- The Serializer to deserialize the meta data and payload withpublic SerializedDomainEventMessage(SerializedEventMessage<T> eventMessage, Object aggregateIdentifier, long sequenceNumber)
aggregateIdentifier
and sequenceNumber
. This constructor should be used to reconstruct
an instance of an existing serialized Domain Event Message
eventMessage
- The eventMessage to wrapaggregateIdentifier
- The identifier of the aggregate that generated the messagesequenceNumber
- The sequence number of the generated eventMethod Detail |
---|
public <R> SerializedObject<R> serializePayload(Serializer serializer, Class<R> expectedRepresentation)
SerializationAware
serializer
, using given
expectedRepresentation
. This method should return the same SerializedObject instance when
invoked multiple times using the same serializer.
serializePayload
in interface SerializationAware
R
- The type of data to serialize toserializer
- The serializer to serialize payload withexpectedRepresentation
- The type of data to serialize to
public <R> SerializedObject<R> serializeMetaData(Serializer serializer, Class<R> expectedRepresentation)
SerializationAware
serializer
, using given
expectedRepresentation
. This method should return the same SerializedObject instance when
invoked multiple times using the same serializer.
serializeMetaData
in interface SerializationAware
R
- The type of data to serialize toserializer
- The serializer to serialize meta data withexpectedRepresentation
- The type of data to serialize to
public long getSequenceNumber()
DomainEventMessage
getSequenceNumber
in interface DomainEventMessage<T>
public Object getAggregateIdentifier()
DomainEventMessage
getAggregateIdentifier
in interface DomainEventMessage<T>
public DomainEventMessage<T> withMetaData(Map<String,?> newMetaData)
DomainEventMessage
metaData
. The payload, Timestamp
and EventIdentifier
, as well as the Aggregate Identifier
and Sequence Number
remain unchanged.
withMetaData
in interface DomainEventMessage<T>
withMetaData
in interface EventMessage<T>
withMetaData
in interface Message<T>
newMetaData
- The new MetaData for the Message
public DomainEventMessage<T> andMetaData(Map<String,?> additionalMetaData)
metaData
. The
payload, Timestamp
and EventIdentifier
, as well as the
Aggregate Identifier
and Sequence Number
remain
unchanged.
This method will force the MetaData to be deserialized if not already done.
andMetaData
in interface DomainEventMessage<T>
andMetaData
in interface EventMessage<T>
andMetaData
in interface Message<T>
additionalMetaData
- The MetaData to merge with
public Class getPayloadType()
Message
getPayload().getClass()
, but allows implementations to optimize by using
lazy loading or deserialization.
getPayloadType
in interface Message<T>
public T getPayload()
Message
getPayload
in interface Message<T>
public MetaData getMetaData()
Message
getMetaData
in interface Message<T>
public org.joda.time.DateTime getTimestamp()
EventMessage
getTimestamp
in interface EventMessage<T>
public String getIdentifier()
EventMessage
getIdentifier
in interface EventMessage<T>
getIdentifier
in interface Message<T>
public boolean isPayloadDeserialized()
true
if the payload is deserialized, otherwise false
protected Object writeReplace()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |