01: /*
02: * $Id: ChildListDefinitionParser.java 11024 2008-02-26 12:47:01Z acooke $
03: * --------------------------------------------------------------------------------------
04: * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com
05: *
06: * The software in this package is published under the terms of the CPAL v1.0
07: * license, a copy of which has been included with this distribution in the
08: * LICENSE.txt file.
09: */
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.ArrayList;
16: import java.util.List;
17:
18: import org.springframework.beans.factory.config.ListFactoryBean;
19: import org.springframework.beans.factory.support.BeanDefinitionBuilder;
20: import org.springframework.beans.factory.xml.ParserContext;
21: import org.w3c.dom.Element;
22:
23: public class ChildListDefinitionParser extends ChildDefinitionParser {
24:
25: public ChildListDefinitionParser(String setterMethod) {
26: super (setterMethod, ArrayList.class);
27: addBeanFlag(MuleHierarchicalBeanDefinitionParserDelegate.MULE_NO_RECURSE);
28: }
29:
30: protected Class getBeanClass(Element element) {
31: return ListFactoryBean.class;
32: }
33:
34: protected void parseChild(Element element,
35: ParserContext parserContext, BeanDefinitionBuilder builder) {
36: super .parseChild(element, parserContext, builder);
37: List parsedList = parserContext.getDelegate().parseListElement(
38: element, builder.getRawBeanDefinition());
39: builder.addPropertyValue("sourceList", parsedList);
40: builder.addPropertyValue("targetListClass", super
41: .getBeanClass(element));
42: }
43:
44: }
|