Coverage Report - org.mule.config.spring.parsers.assembly.AbstractMapBeanAssembler
 
Classes in this File Line Coverage Branch Coverage Complexity
AbstractMapBeanAssembler
0%
0/15
0%
0/2
1.5
 
 1  
 /*
 2  
  * $Id: AbstractMapBeanAssembler.java 19191 2010-08-25 21:05:23Z tcarlson $
 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.config.spring.parsers.assembly;
 12  
 
 13  
 import org.mule.config.spring.parsers.assembly.configuration.PropertyConfiguration;
 14  
 import org.mule.util.MapCombiner;
 15  
 
 16  
 import java.util.Iterator;
 17  
 import java.util.List;
 18  
 import java.util.Map;
 19  
 
 20  
 import org.springframework.beans.PropertyValue;
 21  
 import org.springframework.beans.factory.config.BeanDefinition;
 22  
 import org.springframework.beans.factory.support.BeanDefinitionBuilder;
 23  
 import org.springframework.beans.factory.support.ManagedList;
 24  
 import org.springframework.beans.factory.support.ManagedMap;
 25  
 
 26  
 public abstract class AbstractMapBeanAssembler extends DefaultBeanAssembler
 27  
 {
 28  
 
 29  
     public AbstractMapBeanAssembler(PropertyConfiguration beanConfig, BeanDefinitionBuilder bean,
 30  
                                     PropertyConfiguration targetConfig, BeanDefinition target)
 31  
     {
 32  0
         super(beanConfig, bean, targetConfig, target);
 33  0
     }
 34  
 
 35  
     protected void insertDefinitionAsMap(String oldName)
 36  
     {
 37  0
         BeanDefinitionBuilder builder = BeanDefinitionBuilder.rootBeanDefinition(MapCombiner.class);
 38  0
         Map map = new ManagedMap();
 39  0
         for (Iterator pvs = getBean().getBeanDefinition().getPropertyValues().getPropertyValueList().iterator();
 40  0
              pvs.hasNext();)
 41  
         {
 42  0
             PropertyValue pv = (PropertyValue) pvs.next();
 43  0
             map.put(pv.getName(), pv.getValue());
 44  0
         }
 45  0
         List list = new ManagedList();
 46  0
         list.add(map);
 47  0
         builder.addPropertyValue(MapCombiner.LIST, list);
 48  0
         setBean(builder);
 49  0
         super.insertBeanInTarget(oldName);
 50  0
     }
 51  
 
 52  
 }