Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
ListMessageSplitter |
|
| 0.0;0 |
1 | /* | |
2 | * $Id: ListMessageSplitter.java 20321 2010-11-24 15:21:24Z dfeist $ | |
3 | * -------------------------------------------------------------------------------------- | |
4 | * Copyright (c) MuleSoft, Inc. All rights reserved. http://www.mulesoft.com | |
5 | * | |
6 | * The software in this package is published under the terms of the CPAL v1.0 | |
7 | * license, a copy of which has been included with this distribution in the | |
8 | * LICENSE.txt file. | |
9 | */ | |
10 | ||
11 | package org.mule.routing.outbound; | |
12 | ||
13 | import org.mule.api.MuleMessage; | |
14 | import org.mule.config.i18n.CoreMessages; | |
15 | ||
16 | import java.util.LinkedList; | |
17 | import java.util.List; | |
18 | ||
19 | /** | |
20 | * <code>FilteringListMessageSplitter</code> accepts a List as a message payload | |
21 | * then routes list elements as messages over an endpoint where the endpoint's filter | |
22 | * accepts the payload. | |
23 | */ | |
24 | public class ListMessageSplitter extends AbstractRoundRobinMessageSplitter | |
25 | { | |
26 | public ListMessageSplitter() | |
27 | 0 | { |
28 | 0 | setDisableRoundRobin(true); |
29 | 0 | } |
30 | ||
31 | @Override | |
32 | protected List splitMessage(MuleMessage message) | |
33 | { | |
34 | 0 | if (message.getPayload() instanceof List) |
35 | { | |
36 | 0 | return new LinkedList((List) message.getPayload()); |
37 | } | |
38 | else | |
39 | { | |
40 | 0 | throw new IllegalArgumentException(CoreMessages.objectNotOfCorrectType( |
41 | message.getPayload().getClass(), List.class).getMessage()); | |
42 | } | |
43 | } | |
44 | } |