org.mule.message
Class BaseMessage

java.lang.Object
  extended by org.mule.message.BaseMessage
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
ExceptionMessage

public class BaseMessage
extends Object
implements Serializable

BaseMessage A default message implementation used for messages sent over the wire. client messages should NOT implement MuleMessage.

See Also:
Serialized Form

Field Summary
protected  Map context
           
protected  Object message
           
 
Constructor Summary
BaseMessage(Object message)
           
 
Method Summary
 void addProperties(Map properties)
          Adds a map of properties to associated with this message
 void clearProperties()
          Removes all properties on this message
 Object getPayload()
           
 byte[] getPayloadAsBytes()
          Converts the message implementation into a String representation
 String getPayloadAsString(String encoding)
          Converts the message implementation into a String representation
 Map getProperties()
          Returns a map of all properties on this message
 Object getProperty(Object key)
           
 void setProperty(Object key, Object value)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

message

protected Object message

context

protected Map context
Constructor Detail

BaseMessage

public BaseMessage(Object message)
Method Detail

getPayloadAsString

public String getPayloadAsString(String encoding)
                          throws Exception
Converts the message implementation into a String representation

Returns:
String representation of the message payload
Throws:
Exception - Implementation may throw an endpoint specific exception

getPayloadAsBytes

public byte[] getPayloadAsBytes()
                         throws Exception
Converts the message implementation into a String representation

Returns:
String representation of the message
Throws:
Exception - Implemetation may throw an endpoint specific exception

getPayload

public Object getPayload()
Returns:
the current message

addProperties

public void addProperties(Map properties)
Adds a map of properties to associated with this message

Parameters:
properties - the properties add to this message

clearProperties

public void clearProperties()
Removes all properties on this message


getProperties

public Map getProperties()
Returns a map of all properties on this message

Returns:
a map of all properties on this message

setProperty

public void setProperty(Object key,
                        Object value)

getProperty

public Object getProperty(Object key)

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2003-2009 MuleSource, Inc.. All Rights Reserved.