1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
package org.mule.config.spring.parsers.collection; |
11 | |
|
12 | |
import org.mule.config.spring.MuleHierarchicalBeanDefinitionParserDelegate; |
13 | |
import org.mule.config.spring.parsers.generic.ChildDefinitionParser; |
14 | |
|
15 | |
import java.util.Properties; |
16 | |
|
17 | |
import org.springframework.beans.factory.config.PropertiesFactoryBean; |
18 | |
import org.springframework.beans.factory.support.BeanDefinitionBuilder; |
19 | |
import org.springframework.beans.factory.xml.ParserContext; |
20 | |
import org.w3c.dom.Element; |
21 | |
|
22 | |
|
23 | |
|
24 | |
|
25 | |
|
26 | |
public class ChildPropertiesDefinitionParser extends ChildDefinitionParser |
27 | |
{ |
28 | |
|
29 | |
public ChildPropertiesDefinitionParser(String setterMethod) |
30 | |
{ |
31 | 0 | super(setterMethod, null); |
32 | 0 | addBeanFlag(MuleHierarchicalBeanDefinitionParserDelegate.MULE_NO_RECURSE); |
33 | 0 | } |
34 | |
|
35 | |
protected Class getBeanClass(Element element) |
36 | |
{ |
37 | 0 | return PropertiesFactoryBean.class; |
38 | |
} |
39 | |
|
40 | |
protected void parseChild(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) |
41 | |
{ |
42 | 0 | super.parseChild(element, parserContext, builder); |
43 | 0 | Properties parsedProps = parserContext.getDelegate().parsePropsElement(element); |
44 | 0 | builder.addPropertyValue("properties", parsedProps); |
45 | 0 | } |
46 | |
|
47 | |
} |