Coverage Report - org.mule.routing.CollectionSplitter
 
Classes in this File Line Coverage Branch Coverage Complexity
CollectionSplitter
0%
0/5
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;
 8  
 
 9  
 import org.mule.api.MuleEvent;
 10  
 import org.mule.api.MuleMessage;
 11  
 import org.mule.config.i18n.CoreMessages;
 12  
 
 13  
 import java.util.Collection;
 14  
 import java.util.LinkedList;
 15  
 import java.util.List;
 16  
 
 17  
 /**
 18  
  * Splits a message that has a list payload invoking the next message processor one
 19  
  * for each item in the list in order.
 20  
  * <p>
 21  
  * <b>EIP Reference:</b> <a href="http://www.eaipatterns.com/Sequencer.html">http://www.eaipatterns.com/Sequencer.html</a>
 22  
  */
 23  0
 public class CollectionSplitter extends AbstractSplitter
 24  
 {
 25  
 
 26  
     protected List<MuleMessage> splitMessage(MuleEvent event)
 27  
     {
 28  0
         MuleMessage message = event.getMessage();
 29  0
         if (message.getPayload() instanceof Collection)
 30  
         {
 31  0
             return new LinkedList((Collection) message.getPayload());
 32  
         }
 33  
         else
 34  
         {
 35  0
             throw new IllegalArgumentException(CoreMessages.objectNotOfCorrectType(
 36  
                 message.getPayload().getClass(), List.class).getMessage());
 37  
         }
 38  
     }
 39  
 
 40  
 }