|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.axonframework.serializer.SerializationAwareEventMessage<T>
T
- The payload type of the Messagepublic class SerializationAwareEventMessage<T>
Wrapper around am EventMessage that adds "Serialization Awareness" to the message it wraps. This implementation
ensures that, when the payload or meta data is being serialized more than once using the same serializer, only a
single serialization will actually occur. Subsequent invocations will return the same SerializedObject
instance as the first.
Constructor Summary | |
---|---|
protected |
SerializationAwareEventMessage(EventMessage<T> eventMessage)
Initializes a new wrapper for the given eventMessage . |
Method Summary | ||
---|---|---|
EventMessage<T> |
andMetaData(Map<String,?> metaData)
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. |
|
|
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 . |
|
EventMessage<T> |
withMetaData(Map<String,?> metaData)
Returns a copy of this EventMessage with the given metaData . |
|
static
|
wrap(EventMessage<T> message)
Wrap the given message to make it SerializationAware. |
|
protected Object |
writeReplace()
Replacement function for Java Serialization API. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected SerializationAwareEventMessage(EventMessage<T> eventMessage)
eventMessage
.
eventMessage
- The message to wrapMethod Detail |
---|
public static <T> EventMessage<T> wrap(EventMessage<T> message)
message
to make it SerializationAware. The returning object can be safely cast to
SerializationAware
. If the given message
already implements
SerializationAware
, it is returned as-is. It is therefore not safe to assume the returning message
is an instance of SerializationAwareEventMessage
.
T
- The payload type of the messagemessage
- The message to wrap
public String getIdentifier()
EventMessage
getIdentifier
in interface EventMessage<T>
getIdentifier
in interface Message<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 org.joda.time.DateTime getTimestamp()
EventMessage
getTimestamp
in interface EventMessage<T>
public EventMessage<T> withMetaData(Map<String,?> metaData)
EventMessage
metaData
. The payload, Timestamp
and Identifier
remain unchanged.
withMetaData
in interface EventMessage<T>
withMetaData
in interface Message<T>
metaData
- The new MetaData for the Message
public EventMessage<T> andMetaData(Map<String,?> metaData)
EventMessage
metaData
. The payload,
Timestamp
and Identifier
remain unchanged.
andMetaData
in interface EventMessage<T>
andMetaData
in interface Message<T>
metaData
- The MetaData to merge with
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
protected Object writeReplace()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |