1 24 package org.riotfamily.common.beans.xml; 25 26 import org.springframework.beans.MutablePropertyValues; 27 import org.springframework.beans.factory.config.BeanDefinition; 28 import org.springframework.beans.factory.config.BeanDefinitionHolder; 29 import org.springframework.beans.factory.xml.BeanDefinitionDecorator; 30 import org.springframework.beans.factory.xml.ParserContext; 31 import org.w3c.dom.Element ; 32 import org.w3c.dom.Node ; 33 34 public class NestedPropertyDecorator implements BeanDefinitionDecorator { 35 36 private String propertyName; 37 38 public NestedPropertyDecorator(String propertyName) { 39 this.propertyName = propertyName; 40 } 41 42 public BeanDefinitionHolder decorate(Node node, 43 BeanDefinitionHolder definition, ParserContext parserContext) { 44 45 BeanDefinition bd = definition.getBeanDefinition(); 46 MutablePropertyValues pv = bd.getPropertyValues(); 47 pv.addPropertyValue(propertyName, parserContext.getDelegate().parsePropertySubElement((Element ) node, bd)); 48 return definition; 49 } 50 } | Popular Tags |