View Javadoc
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.assembly;
8   
9   import org.mule.config.spring.parsers.assembly.configuration.PropertyConfiguration;
10  
11  import org.springframework.beans.factory.config.BeanDefinition;
12  import org.springframework.beans.factory.support.BeanDefinitionBuilder;
13  
14  /**
15   * This can be used inside a {@link org.mule.config.spring.parsers.generic.ChildDefinitionParser} - it
16   * takes named properties and, instead of inserting them individually on the target, it packages them as
17   * a Map and inserts that.
18   */
19  public class AttributeMapBeanAssembler extends AbstractMapBeanAssembler
20  {
21  
22      public AttributeMapBeanAssembler(PropertyConfiguration beanConfig, BeanDefinitionBuilder bean,
23                                       PropertyConfiguration targetConfig, BeanDefinition target)
24      {
25          super(beanConfig, bean, targetConfig, target);
26      }
27  
28      /**
29       * We override this method to insert a map instead of the definition.
30       */
31      public void insertBeanInTarget(String oldName)
32      {
33          assertTargetPresent();
34          insertDefinitionAsMap(oldName);
35      }
36  
37  }