Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
NamedSetterChildElementIterator |
|
| 1.0;1 |
1 | /* | |
2 | * $Id: NamedSetterChildElementIterator.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.processors; | |
12 | ||
13 | import org.mule.config.spring.parsers.assembly.BeanAssembler; | |
14 | import org.mule.config.spring.parsers.assembly.BeanAssemblerFactory; | |
15 | import org.mule.config.spring.parsers.assembly.configuration.PropertyConfiguration; | |
16 | ||
17 | import org.w3c.dom.Element; | |
18 | ||
19 | /** | |
20 | * This iterates over the child elements, generates beans, and sets them on the current bean via the | |
21 | * setter given. So presumably there's either a single child or the destination is a collection. | |
22 | * | |
23 | * <p>Since this handles the iteration over children explicitly you need to set the flag | |
24 | * {@link org.mule.config.spring.MuleHierarchicalBeanDefinitionParserDelegate#MULE_NO_RECURSE} | |
25 | * on the parser. | |
26 | * | |
27 | * @see org.mule.config.spring.parsers.processors.AbstractChildElementIterator - please read the | |
28 | * documentation for that processor | |
29 | */ | |
30 | public class NamedSetterChildElementIterator extends AbstractChildElementIterator | |
31 | { | |
32 | ||
33 | private String setter; | |
34 | ||
35 | public NamedSetterChildElementIterator(String setter, BeanAssemblerFactory beanAssemblerFactory, PropertyConfiguration configuration) | |
36 | { | |
37 | 0 | super(beanAssemblerFactory, configuration); |
38 | 0 | this.setter = setter; |
39 | 0 | } |
40 | ||
41 | protected void insertBean(BeanAssembler targetAssembler, Object childBean, Element parent, Element child) | |
42 | { | |
43 | 0 | targetAssembler.extendTarget(setter, setter, childBean); |
44 | 0 | } |
45 | ||
46 | } |