|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.axonframework.serializer.SerializedEventMessage<T>
T
- The type of payload contained in this messagepublic class SerializedEventMessage<T>
EventMessage 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 | |
---|---|
SerializedEventMessage(String eventIdentifier,
org.joda.time.DateTime timestamp,
SerializedObject<?> serializedPayload,
SerializedObject<?> serializedMetaData,
Serializer serializer)
Constructor to reconstruct an EventMessage using serialized data |
Method Summary | ||
---|---|---|
EventMessage<T> |
andMetaData(Map<String,?> additionalMetaData)
Returns a copy of this EventMessage with it MetaData merged with the given metaData . |
|
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. |
|
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 . |
|
SerializedEventMessage<T> |
withMetaData(Map<String,?> newMetaData)
Returns a copy of this EventMessage 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 SerializedEventMessage(String eventIdentifier, org.joda.time.DateTime timestamp, SerializedObject<?> serializedPayload, SerializedObject<?> serializedMetaData, Serializer serializer)
eventIdentifier
- The identifier of the messagetimestamp
- The timestamp of the event messageserializedPayload
- The serialized payload of the messageserializedMetaData
- The serialized meta data of the messageserializer
- The serializer to deserialize the payload and meta data with
UnknownSerializedTypeException
- if the type of the serialized object cannot be resolved to a classMethod 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 String getIdentifier()
EventMessage
getIdentifier
in interface EventMessage<T>
getIdentifier
in interface Message<T>
public org.joda.time.DateTime getTimestamp()
EventMessage
getTimestamp
in interface EventMessage<T>
public MetaData getMetaData()
Message
getMetaData
in interface Message<T>
public T getPayload()
Message
getPayload
in interface Message<T>
public Class getPayloadType()
Message
getPayload().getClass()
, but allows implementations to optimize by using
lazy loading or deserialization.
getPayloadType
in interface Message<T>
public SerializedEventMessage<T> withMetaData(Map<String,?> newMetaData)
EventMessage
metaData
. The payload, Timestamp
and Identifier
remain unchanged.
withMetaData
in interface EventMessage<T>
withMetaData
in interface Message<T>
newMetaData
- The new MetaData for the Message
public EventMessage<T> andMetaData(Map<String,?> additionalMetaData)
EventMessage
metaData
. The payload,
Timestamp
and Identifier
remain unchanged.
andMetaData
in interface EventMessage<T>
andMetaData
in interface Message<T>
additionalMetaData
- The MetaData to merge with
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 |