1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
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.Properties; |
13 | |
|
14 | |
import org.springframework.beans.factory.config.PropertiesFactoryBean; |
15 | |
import org.springframework.beans.factory.support.BeanDefinitionBuilder; |
16 | |
import org.springframework.beans.factory.xml.ParserContext; |
17 | |
import org.w3c.dom.Element; |
18 | |
|
19 | |
|
20 | |
|
21 | |
|
22 | |
|
23 | |
public class ChildPropertiesDefinitionParser extends ChildDefinitionParser |
24 | |
{ |
25 | |
|
26 | |
public ChildPropertiesDefinitionParser(String setterMethod) |
27 | |
{ |
28 | 0 | super(setterMethod, null); |
29 | 0 | addBeanFlag(MuleHierarchicalBeanDefinitionParserDelegate.MULE_NO_RECURSE); |
30 | 0 | } |
31 | |
|
32 | |
protected Class getBeanClass(Element element) |
33 | |
{ |
34 | 0 | return PropertiesFactoryBean.class; |
35 | |
} |
36 | |
|
37 | |
protected void parseChild(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) |
38 | |
{ |
39 | 0 | super.parseChild(element, parserContext, builder); |
40 | 0 | Properties parsedProps = parserContext.getDelegate().parsePropsElement(element); |
41 | 0 | builder.addPropertyValue("properties", parsedProps); |
42 | 0 | } |
43 | |
|
44 | |
} |