DefaultMessageCollection (Mule ESB 2.2.1 API)
Keywords: org.mule.DefaultMessageCollection class

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, MessageAdapter

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

See Also:
  Serialized Form

Nested Class Summary

Nested classes/interfaces inherited from interface org.mule.api.ThreadSafeAccess
`ThreadSafeAccess.AccessControl`

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 org.mule.DefaultMuleMessage
`addAttachment, addProperties, addProperties, applyAllTransformers, applyTransformers, applyTransformers, assertAccess, clearProperties, getAdapter, getAttachment, getAttachmentNames, getBooleanProperty, getCorrelationGroupSize, getCorrelationId, getCorrelationSequence, getDoubleProperty, getEncoding, getExceptionPayload, getIntProperty, getLongProperty, getOrginalPayload, getOriginalAdapter, getPayload, getPayload, getPayloadAsString, getProperty, getProperty, getProperty, getPropertyNames, getPropertyNames, getReplyTo, getStringProperty, getUniqueId, isConsumable, isPayloadConsumed, release, removeAttachment, removeProperty, resetAccessControl, setBooleanProperty, setCorrelationGroupSize, setCorrelationId, setCorrelationSequence, setDoubleProperty, setEncoding, setExceptionPayload, setIntProperty, setLongProperty, setPayload, setProperty, setProperty, setReplyTo, setStringProperty, 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
`applyTransformers, applyTransformers, getAdapter, getOrginalPayload, getOriginalAdapter, getPayloadAsString, setPayload`

Methods inherited from interface org.mule.api.transport.MessageAdapter
`addAttachment, addProperties, addProperties, clearProperties, getAttachment, getAttachmentNames, getBooleanProperty, getCorrelationGroupSize, getCorrelationId, getCorrelationSequence, getDoubleProperty, getEncoding, getExceptionPayload, getIntProperty, getLongProperty, getPayload, getProperty, getProperty, getProperty, getPropertyNames, getPropertyNames, getReplyTo, getStringProperty, getUniqueId, release, removeAttachment, removeProperty, setBooleanProperty, setCorrelationGroupSize, setCorrelationId, setCorrelationSequence, setDoubleProperty, setEncoding, setExceptionPayload, setIntProperty, setLongProperty, setProperty, setProperty, setReplyTo, setStringProperty`

Constructor Detail

### DefaultMessageCollection

    public DefaultMessageCollection()

### DefaultMessageCollection

    public DefaultMessageCollection(DefaultMessageCollection msg)

  Performs a shallow copy

  Parameters:
    `msg` -

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 `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 transfromers added to the reqgistry will be checked for compatability

  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:

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-2009 MuleSource, Inc.. All Rights Reserved.