|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.mule.DefaultMuleMessage
org.mule.DefaultMessageCollection
public class DefaultMessageCollection
A MuleMessage
type that manages a collection of MuleMessage Objects.
Typically this type of message is only used when users explicitly want to work with aggregated or re-sequenced
collections of messages.
Note that the DefaultMuleMessage.getPayload()
for this message will return a List
of payload objects for
each of the Mule messages stored in this collection.
Calling getPayload(Class)
will attempt to transform all payloads and return a List
.
The methods DefaultMuleMessage.getPayloadAsString()
and getPayloadAsBytes()
are unsupported, instead users should
call getPayload(Class)
and pass in the return type byte[].class
or String.class
.
Field Summary |
---|
Fields inherited from interface org.mule.api.ThreadSafeAccess |
---|
READ, WRITE |
Constructor Summary | |
---|---|
DefaultMessageCollection()
|
|
DefaultMessageCollection(DefaultMessageCollection msg)
Performs a shallow copy |
Method Summary | |
---|---|
void |
addMessage(MuleMessage message)
|
void |
addMessage(MuleMessage message,
int index)
|
void |
addMessages(List messages)
|
void |
addMessages(MuleEvent[] events)
|
void |
addMessages(MuleMessage[] messages)
|
MuleMessage |
getMessage(int index)
|
protected List |
getMessageList()
|
MuleMessage[] |
getMessagesAsArray()
|
Object |
getPayload(Class outputType)
Applies the getPayload(Class) call to every message in the collection and returns a
List of results. |
byte[] |
getPayloadAsBytes()
Converts the message implementation into a byte array representation |
String |
getPayloadAsString(String encoding)
Converts the message implementation into a String representation |
protected List |
getPayloadList()
|
Object[] |
getPayloadsAsArray()
|
ThreadSafeAccess |
newThreadCopy()
We need to overload this if we find we want to make this class available to users, but the copy will be expensive; |
void |
removedMessage(MuleMessage message)
|
int |
size()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.mule.api.MuleMessage |
---|
applyTransformers, applyTransformers, getAdapter, getOrginalPayload, getOriginalAdapter, getPayloadAsString, setPayload |
Constructor Detail |
---|
public DefaultMessageCollection()
public DefaultMessageCollection(DefaultMessageCollection msg)
msg
- Method Detail |
---|
public void addMessage(MuleMessage message)
addMessage
in interface MuleMessageCollection
public MuleMessage[] getMessagesAsArray()
getMessagesAsArray
in interface MuleMessageCollection
public Object[] getPayloadsAsArray()
getPayloadsAsArray
in interface MuleMessageCollection
public void removedMessage(MuleMessage message)
removedMessage
in interface MuleMessageCollection
public void addMessage(MuleMessage message, int index)
addMessage
in interface MuleMessageCollection
public void addMessages(MuleEvent[] events)
addMessages
in interface MuleMessageCollection
public void addMessages(List messages)
addMessages
in interface MuleMessageCollection
public void addMessages(MuleMessage[] messages)
addMessages
in interface MuleMessageCollection
public MuleMessage getMessage(int index)
getMessage
in interface MuleMessageCollection
protected List getMessageList()
protected List getPayloadList()
public Object getPayload(Class outputType) throws TransformerException
getPayload(Class)
call to every message in the collection and returns a
List
of results.
Will attempt to obtain the payload of this message with the desired Class type. This will
try and resolve a trnsformr that can do this transformation. If a transformer cannot be found
an exception is thrown. Any transfromers added to the reqgistry will be checked for compatability
getPayload
in interface MuleMessage
getPayload
in class DefaultMuleMessage
outputType
- the desired return type
TransformerException
- if a transformer cannot be found or there is an error during transformation of the
payloadpublic int size()
size
in interface MuleMessageCollection
public byte[] getPayloadAsBytes() throws Exception
getPayloadAsBytes
in interface MuleMessage
getPayloadAsBytes
in class DefaultMuleMessage
Exception
- Implemetation may throw an endpoint specific exceptionpublic String getPayloadAsString(String encoding) throws Exception
getPayloadAsString
in interface MuleMessage
getPayloadAsString
in class DefaultMuleMessage
encoding
- The encoding to use when transforming the message (if
necessary). The parameter is used when converting from a byte array
Exception
- Implementation may throw an endpoint specific exceptionpublic ThreadSafeAccess newThreadCopy()
newThreadCopy
in interface ThreadSafeAccess
newThreadCopy
in class DefaultMuleMessage
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |