Coverage Report - org.mule.config.spring.parsers.specific.properties.NestedMapWithAttributesDefinitionParser
 
Classes in this File Line Coverage Branch Coverage Complexity
NestedMapWithAttributesDefinitionParser
0%
0/4
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.specific.properties;
 8  
 
 9  
 import org.mule.config.spring.parsers.AbstractMuleBeanDefinitionParser;
 10  
 import org.mule.config.spring.parsers.assembly.MapEntryCombiner;
 11  
 import org.mule.config.spring.parsers.collection.ChildSingletonMapDefinitionParser;
 12  
 import org.mule.config.spring.parsers.delegate.AbstractSingleParentFamilyDefinitionParser;
 13  
 import org.mule.config.spring.parsers.generic.AttributePropertiesDefinitionParser;
 14  
 import org.mule.config.spring.parsers.processors.AddAttribute;
 15  
 
 16  
 /**
 17  
  * This generates a nested map (an element of the parent map, with the key "mapKey", which is a map itself)
 18  
  * and then adds any attributes as name/value pairs.  Embedded elements can then insert further entries using
 19  
  * {@link org.mule.config.spring.parsers.collection.ChildSingletonMapDefinitionParser} or, if the entry is
 20  
  * just a simple value, {@link org.mule.config.spring.parsers.specific.properties.SimplePropertyDefinitionParser}.
 21  
  * The target setter is {@link org.mule.config.spring.parsers.assembly.MapEntryCombiner#VALUE}.
 22  
  */
 23  
 public class NestedMapWithAttributesDefinitionParser extends AbstractSingleParentFamilyDefinitionParser
 24  
 {
 25  
 
 26  
     public NestedMapWithAttributesDefinitionParser(String mapSetter, String mapKey)
 27  0
     {
 28  0
         addDelegate(new ChildSingletonMapDefinitionParser(mapSetter))
 29  
                 .addCollection(mapSetter)
 30  
                 .setIgnoredDefault(true)
 31  
                 .removeIgnored(MapEntryCombiner.KEY)
 32  
                 .registerPreProcessor(new AddAttribute(MapEntryCombiner.KEY, mapKey));
 33  0
         addChildDelegate(new AttributePropertiesDefinitionParser(MapEntryCombiner.VALUE))
 34  
                 .addIgnored(AbstractMuleBeanDefinitionParser.ATTRIBUTE_NAME)
 35  
                 .addIgnored(MapEntryCombiner.KEY);
 36  0
     }
 37  
 
 38  
 }
 39