org.springframework.integration.message
Class GenericMessage<T>
java.lang.Object
org.springframework.integration.message.GenericMessage<T>
- All Implemented Interfaces:
- java.io.Serializable, Message<T>
- Direct Known Subclasses:
- ErrorMessage, StringMessage
public class GenericMessage<T>
- extends java.lang.Object
- implements Message<T>
Base Message class defining common properties such as id, header, and lock.
- Author:
- Mark Fisher
- See Also:
- Serialized Form
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
id
private final java.lang.Object id
header
private final MessageHeader header
payload
private final T payload
defaultIdGenerator
private final transient IdGenerator defaultIdGenerator
GenericMessage
public GenericMessage(java.lang.Object id,
T payload)
- Create a new message with the given id and payload.
- Parameters:
id
- unique identifier for this messagepayload
- the message payload
GenericMessage
public GenericMessage(T payload)
- Create a new message with the given payload. The id will be generated by
the default
IdGenerator
strategy.
- Parameters:
payload
- the message payload
GenericMessage
public GenericMessage(T payload,
MessageHeader headerToCopy)
- Create a new message with the given payload. The id will be generated by
the default
IdGenerator
strategy. The header will be populated
with the attributes and properties of the provided header.
- Parameters:
payload
- the message payloadheaderToCopy
- message header whose attributes and properties should
be copied into the new message's header
getId
public java.lang.Object getId()
- Specified by:
getId
in interface Message<T>
getHeader
public MessageHeader getHeader()
- Specified by:
getHeader
in interface Message<T>
getPayload
public T getPayload()
- Specified by:
getPayload
in interface Message<T>
isExpired
public boolean isExpired()
- Specified by:
isExpired
in interface Message<T>
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
copyHeader
public void copyHeader(MessageHeader headerToCopy,
boolean overrideExistingValues)
- Specified by:
copyHeader
in interface Message<T>