|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.axonframework.serializer.SerializedMessage<T>
T - The type of payload contained in this messagepublic class SerializedMessage<T>
Message implementation that is optimized to cope with serialized Payload and MetaData. The Payload and MetaData will only be deserialized when requested.
This implementation is Serializable as per Java specification. Both MetaData and Payload are deserialized prior to being written to the OutputStream.
| Constructor Summary | |
|---|---|
SerializedMessage(String identifier,
SerializedObject<?> serializedPayload,
SerializedObject<?> serializedMetaData,
Serializer serializer)
Reconstructs a Message using the given identifier, serializedPayload,
serializedMetaData and serializer. |
|
| Method Summary | ||
|---|---|---|
SerializedMessage<T> |
andMetaData(Map<String,?> metaData)
Returns a copy of this Message with it MetaData merged with the given metaData. |
|
String |
getIdentifier()
Returns the identifier of this message. |
|
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. |
|
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. |
|
SerializedMessage<T> |
withMetaData(Map<String,?> metaData)
Returns a copy of this Message 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 SerializedMessage(String identifier,
SerializedObject<?> serializedPayload,
SerializedObject<?> serializedMetaData,
Serializer serializer)
identifier, serializedPayload,
serializedMetaData and serializer.
identifier - The identifier of the 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 class| Method Detail |
|---|
public <R> SerializedObject<R> serializePayload(Serializer serializer,
Class<R> expectedRepresentation)
SerializationAwareserializer, using given
expectedRepresentation. This method should return the same SerializedObject instance when
invoked multiple times using the same serializer.
serializePayload in interface SerializationAwareR - 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)
SerializationAwareserializer, using given
expectedRepresentation. This method should return the same SerializedObject instance when
invoked multiple times using the same serializer.
serializeMetaData in interface SerializationAwareR - The type of data to serialize toserializer - The serializer to serialize meta data withexpectedRepresentation - The type of data to serialize to
public String getIdentifier()
Message
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()
MessagegetPayload().getClass(), but allows implementations to optimize by using
lazy loading or deserialization.
getPayloadType in interface Message<T>public SerializedMessage<T> withMetaData(Map<String,?> metaData)
MessagemetaData. 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 Message<T>metaData - The new MetaData for the Message
public SerializedMessage<T> andMetaData(Map<String,?> metaData)
MessagemetaData. The payload
remains unchanged.
andMetaData in interface Message<T>metaData - The MetaData to merge with
public boolean isPayloadDeserialized()
true if the payload is deserialized, otherwise falseprotected Object writeReplace()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||