1 /* 2 * $Id: NamedSetterChildElementIterator.java 19456 2010-09-08 17:07:59Z esteban.robles $ 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 super(beanAssemblerFactory, configuration); 38 this.setter = setter; 39 } 40 41 protected void insertBean(BeanAssembler targetAssembler, Object childBean, Element parent, Element child) 42 { 43 targetAssembler.extendTarget(setter, setter, childBean); 44 } 45 46 }