Coverage Report - org.mule.config.spring.parsers.collection.ChildMapDefinitionParser
 
Classes in this File Line Coverage Branch Coverage Complexity
ChildMapDefinitionParser
0%
0/9
N/A
1
 
 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.config.spring.parsers.collection;
 8  
 
 9  
 import org.mule.config.spring.MuleHierarchicalBeanDefinitionParserDelegate;
 10  
 import org.mule.config.spring.parsers.generic.ChildDefinitionParser;
 11  
 
 12  
 import java.util.HashMap;
 13  
 import java.util.Map;
 14  
 
 15  
 import org.springframework.beans.factory.config.MapFactoryBean;
 16  
 import org.springframework.beans.factory.support.BeanDefinitionBuilder;
 17  
 import org.springframework.beans.factory.xml.ParserContext;
 18  
 import org.w3c.dom.Element;
 19  
 
 20  
 /**
 21  
  * Creates a single Map and processes standard Spring sub elements.  The map is injected
 22  
  * into the parent object (the enclosing XML element). 
 23  
  */
 24  
 public class ChildMapDefinitionParser extends ChildDefinitionParser
 25  
 {
 26  
 
 27  
     public ChildMapDefinitionParser(String setterMethod)
 28  
     {
 29  0
         super(setterMethod, HashMap.class);
 30  0
         addBeanFlag(MuleHierarchicalBeanDefinitionParserDelegate.MULE_NO_RECURSE);
 31  0
     }
 32  
 
 33  
     protected Class getBeanClass(Element element)
 34  
     {
 35  0
         return MapFactoryBean.class;
 36  
     }
 37  
 
 38  
     protected void parseChild(Element element, ParserContext parserContext, BeanDefinitionBuilder builder)
 39  
     {
 40  0
         super.parseChild(element, parserContext, builder);
 41  0
         Map parsedMap = parserContext.getDelegate().parseMapElement(element, builder.getRawBeanDefinition());
 42  0
         builder.addPropertyValue("sourceMap", parsedMap);
 43  0
         builder.addPropertyValue("targetMapClass", super.getBeanClass(element));
 44  0
     }
 45  
 
 46  
 }