public abstract class AbstractMessage<T> extends Object implements Message<T>
Constructor and Description |
---|
AbstractMessage(String identifier)
Initializes a new message with given identifier.
|
Modifier and Type | Method and Description |
---|---|
Message<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.
|
Message<T> |
withMetaData(Map<String,?> metaData)
Returns a copy of this Message with the given
metaData . |
protected abstract Message<T> |
withMetaData(MetaData metaData)
Returns a new message instance with the same payload and properties as this message but given
metaData . |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getMetaData, getPayload, getPayloadType, serializeMetaData, serializePayload
public AbstractMessage(String identifier)
identifier
- the message identifierpublic String getIdentifier()
Message
getIdentifier
in interface Message<T>
public Message<T> withMetaData(@Nonnull Map<String,?> metaData)
Message
metaData
. 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 Messagepublic Message<T> andMetaData(@Nonnull Map<String,?> metaData)
Message
metaData
. The payload remains
unchanged.andMetaData
in interface Message<T>
metaData
- The MetaData to merge withCopyright © 2010–2024. All rights reserved.