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