org.springframework.beans.factory.xml

Interface NamespaceHandler

    • Method Detail

      • parse

        @Nullable
        BeanDefinition parse(org.w3c.dom.Element element,
                                       ParserContext parserContext)
        Parse the specified Element and register any resulting BeanDefinitions with the BeanDefinitionRegistry that is embedded in the supplied ParserContext.

        Implementations should return the primary BeanDefinition that results from the parse phase if they wish to be used nested inside (for example) a <property> tag.

        Implementations may return null if they will not be used in a nested scenario.

        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 be null as explained above)
      • decorate

        @Nullable
        BeanDefinitionHolder decorate(org.w3c.dom.Node source,
                                                BeanDefinitionHolder definition,
                                                ParserContext parserContext)
        Parse the specified Node and decorate the supplied BeanDefinitionHolder, returning the decorated definition.

        The Node may be either an Attr or an Element, 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 ParserContext can be used to register any additional beans needed to support the main definition.

        Parameters:
        source - 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 null value is strictly speaking invalid, but will be leniently treated like the case where the original bean definition gets returned.