类 GenericMessage<T>
- java.lang.Object
- org.springframework.messaging.support.GenericMessage<T>
- 所有已实现的接口:
Serializable
,Message<T>
- 直接已知子类:
ErrorMessage
public class GenericMessage<T> extends Object implements Message<T>, Serializable
An implementation ofMessage
with a generic payload. Once created, a GenericMessage is immutable.- 从以下版本开始:
- 4.0
- 作者:
- Mark Fisher
- 另请参阅:
MessageBuilder
, 序列化表格
构造器概要
构造器 构造器 说明 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.GenericMessage(T payload, MessageHeaders headers)
A constructor with theMessageHeaders
instance to use.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 boolean
equals(Object other)
MessageHeaders
getHeaders()
Return message headers for the message (nevernull
but may be empty).T
getPayload()
Return the message payload.int
hashCode()
String
toString()
构造器详细资料
GenericMessage
public GenericMessage(T payload)
Create a new message with the given payload.- 参数:
payload
- the message payload (nevernull
)
GenericMessage
public GenericMessage(T payload, Map<String,Object> headers)
Create a new message with the given payload and headers. The content of the given header map is copied.- 参数:
payload
- the message payload (nevernull
)headers
- message headers to use for initialization
GenericMessage
public GenericMessage(T payload, MessageHeaders headers)
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.- 参数:
payload
- the message payload (nevernull
)headers
- message headers
方法详细资料
getPayload
public T getPayload()
从接口复制的说明:Message
Return the message payload.- 指定者:
getPayload
在接口中Message<T>
getHeaders
public MessageHeaders getHeaders()
从接口复制的说明:Message
Return message headers for the message (nevernull
but may be empty).- 指定者:
getHeaders
在接口中Message<T>