public class GenericMessage<T> extends Object implements Message<T>, Serializable
Message
with a generic payload.
Once created, a GenericMessage is immutable.MessageBuilder
,
Serialized FormConstructor and Description |
---|
GenericMessage(T payload)
Create a new message with the given payload.
|
GenericMessage(T payload,
Map<String,Object> headers)
Create a new message with the given payload and headers.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object other) |
MessageHeaders |
getHeaders()
Return message headers for the message (never
null but may be empty). |
T |
getPayload()
Return the message payload.
|
int |
hashCode() |
String |
toString() |
public GenericMessage(T payload)
payload
- the message payload (never null
)public T getPayload()
Message
getPayload
in interface Message<T>
public MessageHeaders getHeaders()
Message
null
but may be empty).getHeaders
in interface Message<T>