View Javadoc

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