org.apache.camel.impl
Class DefaultMessage

java.lang.Object
  extended by org.apache.camel.impl.MessageSupport
      extended by org.apache.camel.impl.DefaultMessage
All Implemented Interfaces:
Message
Direct Known Subclasses:
FileMessage, JMXMessage

public class DefaultMessage
extends MessageSupport

The default implementation of Message

Version:
$Revision: 563607 $

Constructor Summary
DefaultMessage()
           
 
Method Summary
protected  Map<String,Object> createHeaders()
          A factory method to lazily create the headers to make it easy to create efficient Message implementations which only construct and populate the Map on demand
 Object getHeader(String name)
          Accesses a specific header
<T> T
getHeader(String name, Class<T> type)
          Returns a header associated with this message by name and specifying the type required
 Map<String,Object> getHeaders()
          Returns all of the headers associated with the message
 DefaultMessage newInstance()
          Returns a new instance
protected  void populateInitialHeaders(Map<String,Object> map)
          A strategy method populate the initial set of headers on an inbound message from an underlying binding
 void setHeader(String name, Object value)
          Sets a header on the message
 void setHeaders(Map<String,Object> headers)
          Set all the headers associated with this message
 String toString()
           
 
Methods inherited from class org.apache.camel.impl.MessageSupport
copy, copyFrom, createBody, getBody, getBody, getExchange, getMessageId, setBody, setBody, setExchange, setMessageId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultMessage

public DefaultMessage()
Method Detail

toString

public String toString()
Overrides:
toString in class Object

getHeader

public Object getHeader(String name)
Description copied from interface: Message
Accesses a specific header

Returns:
object header associated with the name

getHeader

public <T> T getHeader(String name,
                       Class<T> type)
Description copied from interface: Message
Returns a header associated with this message by name and specifying the type required

Parameters:
name - the name of the header
type - the type of the header
Returns:
the value of the given header or null if there is no property for the given name or it cannot be converted to the given type

setHeader

public void setHeader(String name,
                      Object value)
Description copied from interface: Message
Sets a header on the message

Parameters:
name - of the header
value - to associate with the name

getHeaders

public Map<String,Object> getHeaders()
Description copied from interface: Message
Returns all of the headers associated with the message

Returns:
all the headers in a Map

setHeaders

public void setHeaders(Map<String,Object> headers)
Description copied from interface: Message
Set all the headers associated with this message


newInstance

public DefaultMessage newInstance()
Description copied from class: MessageSupport
Returns a new instance

Specified by:
newInstance in class MessageSupport
Returns:

createHeaders

protected Map<String,Object> createHeaders()
A factory method to lazily create the headers to make it easy to create efficient Message implementations which only construct and populate the Map on demand

Returns:
return a newly constructed Map possibly containing headers from the underlying inbound transport

populateInitialHeaders

protected void populateInitialHeaders(Map<String,Object> map)
A strategy method populate the initial set of headers on an inbound message from an underlying binding

Parameters:
map - is the empty header map to populate


Copyright © 2007 Apache Software Foundation. All Rights Reserved.