Coverage Report - org.mule.config.spring.parsers.specific.properties.ElementInNestedMapDefinitionParser
 
Classes in this File Line Coverage Branch Coverage Complexity
ElementInNestedMapDefinitionParser
0%
0/5
N/A
1
 
 1  
 /*
 2  
  * $Id: ElementInNestedMapDefinitionParser.java 10489 2008-01-23 17:53:38Z dfeist $
 3  
  * --------------------------------------------------------------------------------------
 4  
  * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.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.specific.properties;
 12  
 
 13  
 import org.mule.config.spring.parsers.AbstractMuleBeanDefinitionParser;
 14  
 import org.mule.config.spring.parsers.assembly.MapEntryCombiner;
 15  
 import org.mule.config.spring.parsers.collection.ChildSingletonMapDefinitionParser;
 16  
 import org.mule.config.spring.parsers.delegate.AbstractSingleParentFamilyDefinitionParser;
 17  
 import org.mule.config.spring.parsers.processors.AddAttribute;
 18  
 
 19  
 /**
 20  
  * This constructs a nested map - keyed by "mapKey" - and then adds an entry in that
 21  
  * named from the attribute "keyAttribute".  Child elements can then set a value (or
 22  
  * values, if it is a collection) on {@link org.mule.config.spring.parsers.assembly.MapEntryCombiner#VALUE}
 23  
  */
 24  
 public class ElementInNestedMapDefinitionParser extends AbstractSingleParentFamilyDefinitionParser
 25  
 {
 26  
 
 27  
     public ElementInNestedMapDefinitionParser(String mapSetter, String mapKey, String keyAttribute)
 28  0
     {
 29  
         // children (parameters) want to append to the inner map, not the outer one
 30  0
         setReturnFirstResult(false);
 31  0
         addDelegate(new ChildSingletonMapDefinitionParser(mapSetter))
 32  
                 .registerPreProcessor(new AddAttribute(MapEntryCombiner.KEY, mapKey))
 33  
                 .addCollection(mapSetter)
 34  
                 .setIgnoredDefault(true)
 35  
                 .removeIgnored(MapEntryCombiner.KEY)
 36  
                 .addIgnored(AbstractMuleBeanDefinitionParser.ATTRIBUTE_NAME);
 37  0
         addChildDelegate(new ChildSingletonMapDefinitionParser(MapEntryCombiner.VALUE))
 38  
                 .addAlias(keyAttribute, MapEntryCombiner.KEY)
 39  
                 .addCollection(MapEntryCombiner.VALUE)
 40  
                 .addIgnored(AbstractMuleBeanDefinitionParser.ATTRIBUTE_NAME);
 41  0
     }
 42  
 
 43  
 }