|
||||||||||
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 MuleMessage.getPayload(Class)
will attempt to transform all payloads and return a List
.
The methods MuleMessage.getPayloadAsString()
and MuleMessage.getPayloadAsBytes()
are unsupported, instead users should
call MuleMessage.getPayload(Class)
and pass in the return type byte[].class
or String.class
.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.mule.DefaultMuleMessage |
---|
DefaultMuleMessage.SerializedDataHandler |
Nested classes/interfaces inherited from interface org.mule.api.ThreadSafeAccess |
---|
ThreadSafeAccess.AccessControl |
Nested classes/interfaces inherited from interface org.mule.util.store.DeserializationPostInitialisable |
---|
DeserializationPostInitialisable.Implementation |
Field Summary |
---|
Fields inherited from class org.mule.DefaultMuleMessage |
---|
muleContext, NOT_SET |
Fields inherited from interface org.mule.api.ThreadSafeAccess |
---|
READ, WRITE |
Constructor Summary | |
---|---|
DefaultMessageCollection(DefaultMessageCollection msg,
MuleContext muleContext)
Performs a shallow copy |
|
DefaultMessageCollection(MuleContext muleContext)
|
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 |
createInboundMessage()
Copy an inbound message to an outbound one, moving all message properties and attachments |
MuleMessage |
getMessage(int index)
|
protected List |
getMessageList()
|
MuleMessage[] |
getMessagesAsArray()
|
Object |
getPayload(Class outputType)
Applies the MuleMessage.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 |
String |
getPayloadForLogging()
Get the message payload for logging without throwing exception Converts the message implementation into a String representation. |
String |
getPayloadForLogging(String encoding)
Get the message payload for logging without throwing exception 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 |
Constructor Detail |
---|
public DefaultMessageCollection(MuleContext muleContext)
public DefaultMessageCollection(DefaultMessageCollection msg, MuleContext muleContext)
msg
- muleContext
- 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
MuleMessage.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 transformer that can do this transformation. If a transformer cannot be found
an exception is thrown. Any transformers added to the registry will be checked for compatibility
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 String getPayloadForLogging(String encoding)
getPayloadForLogging
in interface MuleMessage
getPayloadForLogging
in class DefaultMuleMessage
public String getPayloadForLogging()
getPayloadForLogging
in interface MuleMessage
getPayloadForLogging
in class DefaultMuleMessage
public ThreadSafeAccess newThreadCopy()
newThreadCopy
in interface ThreadSafeAccess
newThreadCopy
in class DefaultMuleMessage
public MuleMessage createInboundMessage() throws Exception
createInboundMessage
in interface MuleMessage
createInboundMessage
in class DefaultMuleMessage
Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |