org.axonframework.serializer
Class SerializedObjectHolder

java.lang.Object
  extended by org.axonframework.serializer.SerializedObjectHolder
All Implemented Interfaces:
SerializationAware

public class SerializedObjectHolder
extends Object
implements SerializationAware

Holder that keeps references to serialized representations of a payload and meta data of a specific message. Typically, this object should not live longer than the message object is is attached to.

Since:
2.0
Author:
Allard Buijze

Constructor Summary
SerializedObjectHolder(Message message)
          Initialize the holder for the serialized representations of the payload and meta data of given message
 
Method Summary
<T> SerializedObject<T>
serializeMetaData(Serializer serializer, Class<T> expectedRepresentation)
          Serialize the meta data of this message using given serializer, using given expectedRepresentation.
<T> SerializedObject<T>
serializePayload(Serializer serializer, Class<T> expectedRepresentation)
          Serialize the payload of this message using given serializer, using given expectedRepresentation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SerializedObjectHolder

public SerializedObjectHolder(Message message)
Initialize the holder for the serialized representations of the payload and meta data of given message

Parameters:
message - The message to initialize the holder for
Method Detail

serializePayload

public <T> SerializedObject<T> serializePayload(Serializer serializer,
                                                Class<T> expectedRepresentation)
Description copied from interface: SerializationAware
Serialize the payload of this message using given serializer, using given expectedRepresentation. This method should return the same SerializedObject instance when invoked multiple times using the same serializer.

Specified by:
serializePayload in interface SerializationAware
Type Parameters:
T - The type of data to serialize to
Parameters:
serializer - The serializer to serialize payload with
expectedRepresentation - The type of data to serialize to
Returns:
a SerializedObject containing the serialized representation of the message's payload

serializeMetaData

public <T> SerializedObject<T> serializeMetaData(Serializer serializer,
                                                 Class<T> expectedRepresentation)
Description copied from interface: SerializationAware
Serialize the meta data of this message using given serializer, using given expectedRepresentation. This method should return the same SerializedObject instance when invoked multiple times using the same serializer.

Specified by:
serializeMetaData in interface SerializationAware
Type Parameters:
T - The type of data to serialize to
Parameters:
serializer - The serializer to serialize meta data with
expectedRepresentation - The type of data to serialize to
Returns:
a SerializedObject containing the serialized representation of the message's meta data


Copyright © 2010-2016. All Rights Reserved.