Class SimpleConstructorNamespaceHandler
java.lang.Object
org.springframework.beans.factory.xml.SimpleConstructorNamespaceHandler
- All Implemented Interfaces:
- NamespaceHandler
Simple 
NamespaceHandler implementation that maps custom
 attributes directly through to bean properties. An important point to note is
 that this NamespaceHandler does not have a corresponding schema
 since there is no way to know in advance all possible attribute names.
 An example of the usage of this NamespaceHandler is shown below:
 
<bean id="author" class="..TestBean" c:name="Enescu" c:work-ref="compositions"/>Here the '
c:name' corresponds directly to the 'name
 ' argument declared on the constructor of class 'TestBean'. The
 'c:work-ref' attributes corresponds to the 'work'
 argument and, rather than being the concrete value, it contains the name of
 the bean that will be considered as a parameter.
 Note: This implementation supports only named parameters - there is no
 support for indexes or types. Furthermore, the names are used as hints by
 the container which, by default, does type introspection.- Since:
- 3.1
- Author:
- Costin Leau
- See Also:
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptiondecorate(Node node, BeanDefinitionHolder definition, ParserContext parserContext) Parse the specifiedNodeand decorate the suppliedBeanDefinitionHolder, returning the decorated definition.voidinit()Invoked by theDefaultBeanDefinitionDocumentReaderafter construction but before any custom elements are parsed.parse(Element element, ParserContext parserContext) Parse the specifiedElementand register any resultingBeanDefinitionswith theBeanDefinitionRegistrythat is embedded in the suppliedParserContext.
- 
Constructor Details- 
SimpleConstructorNamespaceHandlerpublic SimpleConstructorNamespaceHandler()
 
- 
- 
Method Details- 
initpublic void init()Description copied from interface:NamespaceHandlerInvoked by theDefaultBeanDefinitionDocumentReaderafter construction but before any custom elements are parsed.- Specified by:
- initin interface- NamespaceHandler
- See Also:
 
- 
parseDescription copied from interface:NamespaceHandlerParse the specifiedElementand register any resultingBeanDefinitionswith theBeanDefinitionRegistrythat is embedded in the suppliedParserContext.Implementations should return the primary BeanDefinitionthat results from the parse phase if they wish to be used nested inside (for example) a<property>tag.Implementations may return nullif they will not be used in a nested scenario.- Specified by:
- parsein interface- NamespaceHandler
- Parameters:
- element- the element that is to be parsed into one or more- BeanDefinitions
- parserContext- the object encapsulating the current state of the parsing process
- Returns:
- the primary BeanDefinition(can benullas explained above)
 
- 
decoratepublic BeanDefinitionHolder decorate(Node node, BeanDefinitionHolder definition, ParserContext parserContext) Description copied from interface:NamespaceHandlerParse the specifiedNodeand decorate the suppliedBeanDefinitionHolder, returning the decorated definition.The Nodemay be either anAttror anElement, depending on whether a custom attribute or element is being parsed.Implementations may choose to return a completely new definition, which will replace the original definition in the resulting BeanFactory.The supplied ParserContextcan be used to register any additional beans needed to support the main definition.- Specified by:
- decoratein interface- NamespaceHandler
- Parameters:
- node- the source element or attribute that is to be parsed
- definition- the current bean definition
- parserContext- the object encapsulating the current state of the parsing process
- Returns:
- the decorated definition (to be registered in the BeanFactory),
 or simply the original bean definition if no decoration is required.
 A nullvalue is strictly speaking invalid, but will be leniently treated like the case where the original bean definition gets returned.
 
 
-