Spring Integration

org.springframework.integration.message
Class GenericMessage<T>

java.lang.Object
  extended by org.springframework.integration.message.GenericMessage<T>
All Implemented Interfaces:
java.io.Serializable, Message<T>
Direct Known Subclasses:
AdviceMessage, ErrorMessage

public class GenericMessage<T>
extends java.lang.Object
implements Message<T>, java.io.Serializable

Base Message class defining common properties such as id, payload, and headers. Once created this object is immutable.

Author:
Mark Fisher
See Also:
Serialized Form

Constructor Summary
GenericMessage(T payload)
          Create a new message with the given payload.
GenericMessage(T payload, java.util.Map<java.lang.String,java.lang.Object> headers)
          Create a new message with the given payload.
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 MessageHeaders getHeaders()
           
 T getPayload()
           
 int hashCode()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GenericMessage

public GenericMessage(T payload)
Create a new message with the given payload.

Parameters:
payload - the message payload

GenericMessage

public GenericMessage(T payload,
                      java.util.Map<java.lang.String,java.lang.Object> headers)
Create a new message with the given payload. The provided map will be used to populate the message headers

Parameters:
payload - the message payload
headers - message headers
See Also:
MessageHeaders
Method Detail

getHeaders

public MessageHeaders getHeaders()
Specified by:
getHeaders in interface Message<T>

getPayload

public T getPayload()
Specified by:
getPayload in interface Message<T>

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

Spring Integration