public abstract class MessageDecorator<T> extends Object implements Message<T>, SerializationAware
Message that delegates to an existing message. Extend this decorator class to
extend the message with additional features.
Messages of this type are SerializationAware meaning they will not be serialized more than once by the same
serializer.
| Modifier | Constructor and Description |
|---|---|
protected |
MessageDecorator(Message<T> delegate)
Initializes a new decorator with given
delegate message. |
| Modifier and Type | Method and Description |
|---|---|
protected Message<T> |
getDelegate()
Returns the wrapped message delegate.
|
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<T> |
getPayloadType()
Returns the type of the payload.
|
<S> SerializedObject<S> |
serializeMetaData(Serializer serializer,
Class<S> expectedRepresentation)
Serialize the meta data of this message using given
serializer, using given
expectedRepresentation. |
<S> SerializedObject<S> |
serializePayload(Serializer serializer,
Class<S> expectedRepresentation)
Serialize the payload of this message using given
serializer, using given
expectedRepresentation. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitandMetaData, withMetaDatapublic String getIdentifier()
MessagegetIdentifier in interface Message<T>public MetaData getMetaData()
MessagegetMetaData in interface Message<T>public T getPayload()
MessagegetPayload in interface Message<T>public Class<T> getPayloadType()
MessagegetPayload().getClass(), but allows implementations to optimize by using
lazy loading or deserialization.getPayloadType in interface Message<T>public <S> SerializedObject<S> serializePayload(Serializer serializer, Class<S> expectedRepresentation)
SerializationAwareserializer, using given
expectedRepresentation. This method should return the same SerializedObject instance when
invoked multiple times using the same serializer.serializePayload in interface SerializationAwareS - The type of data to serialize toserializer - The serializer to serialize payload withexpectedRepresentation - The type of data to serialize topublic <S> SerializedObject<S> serializeMetaData(Serializer serializer, Class<S> expectedRepresentation)
SerializationAwareserializer, using given
expectedRepresentation. This method should return the same SerializedObject instance when
invoked multiple times using the same serializer.serializeMetaData in interface SerializationAwareS - The type of data to serialize toserializer - The serializer to serialize meta data withexpectedRepresentation - The type of data to serialize toCopyright © 2010–2017. All rights reserved.