Class XBeanNamespaceHandler
java.lang.Object
org.apache.xbean.spring.context.v2c.XBeanNamespaceHandler
- All Implemented Interfaces:
org.springframework.beans.factory.xml.NamespaceHandler
public class XBeanNamespaceHandler
extends Object
implements org.springframework.beans.factory.xml.NamespaceHandler
An enhanced XML parser capable of handling custom XML schemas.
- Since:
- 2.0
- Version:
- $Id$
- Author:
- James Strachan
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final NamedConstructorArgsprotected static final String[]protected static final String[]All the reserved Spring XML element names which cannot be overloaded by an XML extensionstatic final Stringstatic final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddAttributeProperties(org.springframework.beans.factory.config.BeanDefinitionHolder definition, MappingMetaData metadata, String className, Element element) Parses attribute names and values as being bean property expressionsprotected voidaddAttributeProperty(org.springframework.beans.factory.config.BeanDefinitionHolder definition, MappingMetaData metadata, Element element, Attr attribute) protected voidaddContentProperty(org.springframework.beans.factory.config.BeanDefinitionHolder definition, MappingMetaData metadata, Element element) protected voidaddNestedPropertyElements(org.springframework.beans.factory.config.BeanDefinitionHolder definition, MappingMetaData metadata, String className, Element element) Lets iterate through the children of this element and create any nested child propertiesprotected voidaddProperty(org.springframework.beans.factory.config.BeanDefinitionHolder definition, MappingMetaData metadata, Element element, String localName, String value) Add a property onto the current BeanDefinition.protected voidaddSpringAttributeValues(String className, Element element) protected voidaddValueToMap(Map map, Object keyValue, Object value, String dups) protected ElementcloneElement(Element element) Creates a clone of the element and its attribute (though not its content)static voidconfigure(org.springframework.context.support.AbstractApplicationContext context, org.springframework.beans.factory.xml.XmlBeanDefinitionReader reader) Configures the XmlBeanDefinitionReader to work nicely with extensible XML using this reader implementation.protected PropertyEditorcreatePropertyEditor(String propertyEditor) protected voiddeclareLifecycleMethods(org.springframework.beans.factory.config.BeanDefinitionHolder definitionHolder, MappingMetaData metaData, Element element) org.springframework.beans.factory.config.BeanDefinitionHolderdecorate(Node node, org.springframework.beans.factory.config.BeanDefinitionHolder definition, org.springframework.beans.factory.xml.ParserContext parserContext) protected MappingMetaDatafindNamespaceProperties(String namespaceURI, String localName) Uses META-INF/services discovery to find a Properties file with the XML marshaling configurationprotected StringgetElementText(Element element) Returns the text of the elementprotected ElementgetFirstChildElement(Element element) protected StringgetLocalName(Element element) protected PropertyDescriptorgetPropertyDescriptor(String className, String localName) Looks up the property decriptor for the given class and property nameprotected Objectvoidinit()protected booleanisCollection(Class type) Returns true if the given type is a collection type or an arrayprotected booleanisDefaultNamespace(String namespaceUri) protected booleanprotected booleanprotected InputStreamloadResource(String uri) Loads the resource from the given URIorg.springframework.beans.factory.config.BeanDefinitionprotected org.springframework.beans.factory.config.BeanDefinitionHolderparseBeanFromExtensionElement(Element element) Parses the non-standard XML element as a Spring bean definitionprotected org.springframework.beans.factory.config.BeanDefinitionHolderparseBeanFromExtensionElement(Element element, String parentClass, String property) Parses the non-standard XML element as a Spring bean definitionprotected ObjectparseChildExtensionBean(Element element) Iterates the children of this element to find the first nested beanprotected ObjectparseCustomMapElement(MappingMetaData metadata, Element element, String name) protected ObjectparseListElement(Element element, String name) static voidregisterCustomEditors(org.springframework.beans.factory.support.DefaultListableBeanFactory beanFactory) Registers whatever custom editors we needprotected ClassresolveBeanClass(org.springframework.beans.factory.support.AbstractBeanDefinition bd, String beanName) protected ObjecttryParseNestedPropertyViaIntrospection(MappingMetaData metadata, String className, Element element) Attempts to use introspection to parse the nested property element.
-
Field Details
-
SPRING_SCHEMA
- See Also:
-
SPRING_SCHEMA_COMPAT
- See Also:
-
RESERVED_ELEMENT_NAMES
All the reserved Spring XML element names which cannot be overloaded by an XML extension -
RESERVED_BEAN_ATTRIBUTE_NAMES
-
namedConstructorArgs
-
-
Constructor Details
-
XBeanNamespaceHandler
public XBeanNamespaceHandler()
-
-
Method Details
-
init
public void init()- Specified by:
initin interfaceorg.springframework.beans.factory.xml.NamespaceHandler
-
parse
public org.springframework.beans.factory.config.BeanDefinition parse(Element element, org.springframework.beans.factory.xml.ParserContext parserContext) - Specified by:
parsein interfaceorg.springframework.beans.factory.xml.NamespaceHandler
-
decorate
public org.springframework.beans.factory.config.BeanDefinitionHolder decorate(Node node, org.springframework.beans.factory.config.BeanDefinitionHolder definition, org.springframework.beans.factory.xml.ParserContext parserContext) - Specified by:
decoratein interfaceorg.springframework.beans.factory.xml.NamespaceHandler
-
configure
public static void configure(org.springframework.context.support.AbstractApplicationContext context, org.springframework.beans.factory.xml.XmlBeanDefinitionReader reader) Configures the XmlBeanDefinitionReader to work nicely with extensible XML using this reader implementation. -
registerCustomEditors
public static void registerCustomEditors(org.springframework.beans.factory.support.DefaultListableBeanFactory beanFactory) Registers whatever custom editors we need -
parseBeanFromExtensionElement
protected org.springframework.beans.factory.config.BeanDefinitionHolder parseBeanFromExtensionElement(Element element, String parentClass, String property) Parses the non-standard XML element as a Spring bean definition -
resolveBeanClass
-
parseBeanFromExtensionElement
protected org.springframework.beans.factory.config.BeanDefinitionHolder parseBeanFromExtensionElement(Element element) Parses the non-standard XML element as a Spring bean definition -
addSpringAttributeValues
-
cloneElement
Creates a clone of the element and its attribute (though not its content) -
addAttributeProperties
protected void addAttributeProperties(org.springframework.beans.factory.config.BeanDefinitionHolder definition, MappingMetaData metadata, String className, Element element) Parses attribute names and values as being bean property expressions -
addContentProperty
protected void addContentProperty(org.springframework.beans.factory.config.BeanDefinitionHolder definition, MappingMetaData metadata, Element element) -
addAttributeProperty
protected void addAttributeProperty(org.springframework.beans.factory.config.BeanDefinitionHolder definition, MappingMetaData metadata, Element element, Attr attribute) -
addProperty
protected void addProperty(org.springframework.beans.factory.config.BeanDefinitionHolder definition, MappingMetaData metadata, Element element, String localName, String value) Add a property onto the current BeanDefinition. -
getValue
-
createPropertyEditor
-
getLocalName
-
addNestedPropertyElements
protected void addNestedPropertyElements(org.springframework.beans.factory.config.BeanDefinitionHolder definition, MappingMetaData metadata, String className, Element element) Lets iterate through the children of this element and create any nested child properties -
tryParseNestedPropertyViaIntrospection
protected Object tryParseNestedPropertyViaIntrospection(MappingMetaData metadata, String className, Element element) Attempts to use introspection to parse the nested property element. -
getPropertyDescriptor
Looks up the property decriptor for the given class and property name -
parseListElement
-
parseCustomMapElement
-
addValueToMap
-
getFirstChildElement
-
isMap
-
isCollection
Returns true if the given type is a collection type or an array -
parseChildExtensionBean
Iterates the children of this element to find the first nested bean -
findNamespaceProperties
Uses META-INF/services discovery to find a Properties file with the XML marshaling configuration- Parameters:
namespaceURI- the namespace URI of the elementlocalName- the local name of the element- Returns:
- the properties configuration of the namespace or null if none could be found
-
loadResource
Loads the resource from the given URI -
isEmpty
-
isDefaultNamespace
-
declareLifecycleMethods
protected void declareLifecycleMethods(org.springframework.beans.factory.config.BeanDefinitionHolder definitionHolder, MappingMetaData metaData, Element element) -
getElementText
Returns the text of the element
-