Class GenericMessage<T>
java.lang.Object
org.springframework.messaging.support.GenericMessage<T>
- All Implemented Interfaces:
Serializable
,org.springframework.messaging.Message<T>
public class GenericMessage<T>
extends Object
implements org.springframework.messaging.Message<T>, Serializable
An implementation of
Message
with a generic payload.
Once created, a GenericMessage is immutable.- Since:
- 4.0
- Author:
- Mark Fisher
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final org.springframework.messaging.MessageHeaders
private final T
private static final long
-
Constructor Summary
ConstructorsConstructorDescriptionGenericMessage
(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.GenericMessage
(T payload, org.springframework.messaging.MessageHeaders headers) A constructor with theMessageHeaders
instance to use. -
Method Summary
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
payload
-
headers
private final org.springframework.messaging.MessageHeaders headers
-
-
Constructor Details
-
GenericMessage
Create a new message with the given payload.- Parameters:
payload
- the message payload (nevernull
)
-
GenericMessage
Create a new message with the given payload and headers. The content of the given header map is copied.- Parameters:
payload
- the message payload (nevernull
)headers
- message headers to use for initialization
-
GenericMessage
A constructor with theMessageHeaders
instance to use.Note: the given
MessageHeaders
instance is used directly in the new message, i.e. it is not copied.- Parameters:
payload
- the message payload (nevernull
)headers
- message headers
-
-
Method Details