Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.mule
Class DefaultMessageCollection

    java.lang.Object
      org.mule.DefaultMuleMessage
          org.mule.DefaultMessageCollection

All Implemented Interfaces:
  Serializable, MuleMessage, MuleMessageCollection, ThreadSafeAccess, DeserializationPostInitialisable

    public class DefaultMessageCollection

extends DefaultMuleMessage
implements MuleMessageCollection

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`.

See Also:
  Serialized Form

Nested Class Summary

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
`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 org.mule.DefaultMuleMessage
`addAttachment, addInboundAttachment, addInboundProperties, addOutboundAttachment, addOutboundAttachment, addProperties, addProperties, applyAllTransformers, applyTransformers, applyTransformers, applyTransformers, assertAccess, clearProperties, clearProperties, copyToInbound, findPropertyInAnyScope, findPropertyInSpecifiedScopes, getAttachment, getAttachmentNames, getBooleanProperty, getCorrelationGroupSize, getCorrelationId, getCorrelationSequence, getDataType, getDoubleProperty, getEncoding, getExceptionPayload, getInboundAttachment, getInboundAttachmentNames, getInboundProperty, getInboundProperty, getInboundPropertyNames, getIntProperty, getInvocationProperty, getInvocationProperty, getInvocationPropertyNames, getLongProperty, getMuleContext, getOriginalPayload, getOutboundAttachment, getOutboundAttachmentNames, getOutboundProperty, getOutboundProperty, getOutboundPropertyNames, getPayload, getPayload, getPayload, getPayloadAsString, getProperty, getProperty, getProperty, getProperty, getPropertyNames, getPropertyNames, getReplyTo, getSessionProperty, getSessionProperty, getSessionPropertyNames, getStringProperty, getUniqueId, initAfterDeserialisation, isConsumable, isDisabled, isPayloadConsumed, newException, release, removeAttachment, removeOutboundAttachment, removeProperty, removeProperty, resetAccessControl, setBooleanProperty, setCorrelationGroupSize, setCorrelationId, setCorrelationSequence, setDataType, setDoubleProperty, setEncoding, setExceptionPayload, setInboundProperty, setIntProperty, setInvocationProperty, setLongProperty, setMimeType, setOutboundProperty, setPayload, setProperty, setProperty, setReplyTo, setSessionProperty, setStringProperty, setUniqueId, toString`

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
`addAttachment, addOutboundAttachment, addOutboundAttachment, addProperties, addProperties, applyTransformers, applyTransformers, applyTransformers, clearProperties, clearProperties, findPropertyInAnyScope, getAttachment, getAttachmentNames, getBooleanProperty, getCorrelationGroupSize, getCorrelationId, getCorrelationSequence, getDataType, getDoubleProperty, getEncoding, getExceptionPayload, getInboundAttachment, getInboundAttachmentNames, getInboundProperty, getInboundProperty, getInboundPropertyNames, getIntProperty, getInvocationProperty, getInvocationProperty, getInvocationPropertyNames, getLongProperty, getMuleContext, getOriginalPayload, getOutboundAttachment, getOutboundAttachmentNames, getOutboundProperty, getOutboundProperty, getOutboundPropertyNames, getPayload, getPayload, getPayloadAsString, getProperty, getProperty, getProperty, getProperty, getPropertyNames, getPropertyNames, getReplyTo, getSessionProperty, getSessionProperty, getSessionPropertyNames, getStringProperty, getUniqueId, release, removeAttachment, removeOutboundAttachment, removeProperty, removeProperty, setBooleanProperty, setCorrelationGroupSize, setCorrelationId, setCorrelationSequence, setDoubleProperty, setEncoding, setExceptionPayload, setIntProperty, setInvocationProperty, setLongProperty, setOutboundProperty, setPayload, setProperty, setProperty, setReplyTo, setSessionProperty, setStringProperty`

Constructor Detail

### DefaultMessageCollection

    public DefaultMessageCollection(MuleContext muleContext)

### DefaultMessageCollection

    public DefaultMessageCollection(DefaultMessageCollection msg,
                                    MuleContext muleContext)

  Performs a shallow copy

  Parameters:
    `msg` -
    `muleContext` -

Method Detail

### addMessage

    public void addMessage(MuleMessage message)

  Specified by:
    `addMessage` in interface `MuleMessageCollection`

### getMessagesAsArray

    public MuleMessage[] getMessagesAsArray()

  Specified by:
    `getMessagesAsArray` in interface `MuleMessageCollection`

### getPayloadsAsArray

    public Object[] getPayloadsAsArray()

  Specified by:
    `getPayloadsAsArray` in interface `MuleMessageCollection`

### removedMessage

    public void removedMessage(MuleMessage message)

  Specified by:
    `removedMessage` in interface `MuleMessageCollection`

### addMessage

    public void addMessage(MuleMessage message,
                           int index)

  Specified by:
    `addMessage` in interface `MuleMessageCollection`

### addMessages

    public void addMessages(MuleEvent[] events)

  Specified by:
    `addMessages` in interface `MuleMessageCollection`

### addMessages

    public void addMessages(List messages)

  Specified by:
    `addMessages` in interface `MuleMessageCollection`

### addMessages

    public void addMessages(MuleMessage[] messages)

  Specified by:
    `addMessages` in interface `MuleMessageCollection`

### getMessage

    public MuleMessage getMessage(int index)

  Specified by:
    `getMessage` in interface `MuleMessageCollection`

### getMessageList

    protected List getMessageList()

### getPayloadList

    protected List getPayloadList()

### getPayload

    public Object getPayload(Class outputType)
                      throws TransformerException

  Applies the `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

  Specified by:
    `getPayload` in interface `MuleMessage`
  Overrides:
    `getPayload` in class `DefaultMuleMessage`
  Parameters:
    `outputType` - the desired return type
  Returns:
    The converted payload of this message. Note that this method will not alter the payload of this message *unless* the payload is an InputStream in which case the stream will be read and the payload will become the fully read stream.
  Throws:
    `TransformerException` - if a transformer cannot be found or there is an error during transformation of the payload

### size

    public int size()

  Specified by:
    `size` in interface `MuleMessageCollection`

### getPayloadAsBytes

    public byte[] getPayloadAsBytes()
                             throws Exception

  Converts the message implementation into a byte array representation

  Specified by:
    `getPayloadAsBytes` in interface `MuleMessage`
  Overrides:
    `getPayloadAsBytes` in class `DefaultMuleMessage`
  Returns:
    byte array of the message
  Throws:
    `Exception` - Implemetation may throw an endpoint specific exception

### getPayloadAsString

    public String getPayloadAsString(String encoding)
                              throws Exception

  Converts the message implementation into a String representation

  Specified by:
    `getPayloadAsString` in interface `MuleMessage`
  Overrides:
    `getPayloadAsString` in class `DefaultMuleMessage`
  Parameters:
    `encoding` - The encoding to use when transforming the message (if necessary). The parameter is used when converting from a byte array
  Returns:
    String representation of the message payload
  Throws:
    `Exception` - Implementation may throw an endpoint specific exception

### newThreadCopy

    public 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;

  Specified by:
    `newThreadCopy` in interface `ThreadSafeAccess`
  Overrides:
    `newThreadCopy` in class `DefaultMuleMessage`
  Returns:
    A new instance of the implementing class, unbound to any thread and mutable.

### createInboundMessage

    public MuleMessage createInboundMessage()
                                     throws Exception

  Copy an inbound message to an outbound one, moving all message properties and attachments

  Specified by:
    `createInboundMessage` in interface `MuleMessage`
  Overrides:
    `createInboundMessage` in class `DefaultMuleMessage`
  Returns:
    the inbound message
  Throws:
    `Exception`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2010 MuleSoft, Inc.. All Rights Reserved.