|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.beans.factory.xml.DefaultXmlBeanDefinitionParser
Default implementation of the XmlBeanDefinitionParser interface. Parses bean definitions according to the "spring-beans" DTD, i.e. Spring's default XML bean definition format.
The structure, elements and attribute names of the required XML document are hard-coded in this class. (Of course a transform could be run if necessary to produce this format). "beans" doesn't need to be the root element of the XML document: This class will parse all bean definition elements in the XML file.
Constructor Summary | |
DefaultXmlBeanDefinitionParser()
|
Method Summary | |
protected int |
getAutowireMode(String att)
|
protected BeanDefinitionReader |
getBeanDefinitionReader()
|
protected List |
getChildElementsByTagName(Element mapEle,
String elementName)
Don't use the horrible DOM API to get child elements: Get an element's children with a given element name |
protected ConstructorArgumentValues |
getConstructorArgSubElements(Element beanEle,
String beanName)
Parse constructor argument subelements of the given bean element. |
protected String |
getDefaultAutowire()
|
protected String |
getDefaultDependencyCheck()
|
protected String |
getDefaultLazyInit()
|
protected int |
getDependencyCheck(String att)
|
protected List |
getList(Element collectionEle,
String beanName)
|
protected void |
getLookupOverrideSubElements(Element beanEle,
String beanName,
MethodOverrides overrides)
Parse lookup-override sub elements. |
protected Map |
getMap(Element mapEle,
String beanName)
|
protected Object |
getPropertyValue(Element ele,
String beanName,
String propertyName)
Get the value of a property element. |
protected MutablePropertyValues |
getPropertyValueSubElements(Element beanEle,
String beanName)
Parse property value subelements of the given bean element. |
protected Properties |
getProps(Element propsEle,
String beanName)
|
protected void |
getReplacedMethodSubElements(Element beanEle,
String beanName,
MethodOverrides overrides)
|
protected Resource |
getResource()
|
protected Set |
getSet(Element collectionEle,
String beanName)
|
protected String |
getTextValue(Element ele,
String beanName)
Make the horrible DOM API slightly more bearable: get the text value we know this element contains. |
protected void |
importBeanDefinitionResource(Element ele)
Parse an "import" element and load the bean definitions from the given resource into the bean factory. |
protected BeanDefinitionHolder |
parseBeanDefinition(Element ele)
Parse a standard bean definition into a BeanDefinitionHolder, including bean name and aliases. |
protected BeanDefinition |
parseBeanDefinition(Element ele,
String beanName)
Parse the BeanDefinition itself, without regard to name or aliases. |
protected void |
parseConstructorArgElement(Element ele,
String beanName,
ConstructorArgumentValues cargs)
Parse a constructor-arg element. |
protected void |
parsePropertyElement(Element ele,
String beanName,
MutablePropertyValues pvs)
Parse a property element. |
protected Object |
parsePropertySubelement(Element ele,
String beanName)
Parse a value, ref or collection subelement of a property element |
int |
registerBeanDefinitions(BeanDefinitionReader reader,
Document doc,
Resource resource)
Parse bean definitions from the given DOM document, and register them with the given bean factory. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String BEAN_NAME_DELIMITERS
public static final String TRUE_VALUE
public static final String DEFAULT_VALUE
public static final String DESCRIPTION_ELEMENT
public static final String AUTOWIRE_BY_NAME_VALUE
public static final String AUTOWIRE_BY_TYPE_VALUE
public static final String AUTOWIRE_CONSTRUCTOR_VALUE
public static final String AUTOWIRE_AUTODETECT_VALUE
public static final String DEPENDENCY_CHECK_ALL_ATTRIBUTE_VALUE
public static final String DEPENDENCY_CHECK_SIMPLE_ATTRIBUTE_VALUE
public static final String DEPENDENCY_CHECK_OBJECTS_ATTRIBUTE_VALUE
public static final String DEFAULT_LAZY_INIT_ATTRIBUTE
public static final String DEFAULT_DEPENDENCY_CHECK_ATTRIBUTE
public static final String DEFAULT_AUTOWIRE_ATTRIBUTE
public static final String IMPORT_ELEMENT
public static final String RESOURCE_ATTRIBUTE
public static final String BEAN_ELEMENT
public static final String ID_ATTRIBUTE
public static final String NAME_ATTRIBUTE
public static final String PARENT_ATTRIBUTE
public static final String CLASS_ATTRIBUTE
public static final String ABSTRACT_ATTRIBUTE
public static final String SINGLETON_ATTRIBUTE
public static final String LAZY_INIT_ATTRIBUTE
public static final String AUTOWIRE_ATTRIBUTE
public static final String DEPENDENCY_CHECK_ATTRIBUTE
public static final String DEPENDS_ON_ATTRIBUTE
public static final String INIT_METHOD_ATTRIBUTE
public static final String DESTROY_METHOD_ATTRIBUTE
public static final String FACTORY_METHOD_ATTRIBUTE
public static final String FACTORY_BEAN_ATTRIBUTE
public static final String CONSTRUCTOR_ARG_ELEMENT
public static final String INDEX_ATTRIBUTE
public static final String TYPE_ATTRIBUTE
public static final String PROPERTY_ELEMENT
public static final String LOOKUP_METHOD_ELEMENT
public static final String REPLACED_METHOD_ELEMENT
public static final String REPLACER_ATTRIBUTE
public static final String ARG_TYPE_ELEMENT
public static final String ARG_TYPE_MATCH_ATTRIBUTE
public static final String REF_ELEMENT
public static final String IDREF_ELEMENT
public static final String BEAN_REF_ATTRIBUTE
public static final String LOCAL_REF_ATTRIBUTE
public static final String PARENT_REF_ATTRIBUTE
public static final String LIST_ELEMENT
public static final String SET_ELEMENT
public static final String MAP_ELEMENT
public static final String ENTRY_ELEMENT
public static final String KEY_ATTRIBUTE
public static final String PROPS_ELEMENT
public static final String PROP_ELEMENT
public static final String VALUE_ELEMENT
public static final String NULL_ELEMENT
protected final Log logger
Constructor Detail |
public DefaultXmlBeanDefinitionParser()
Method Detail |
public int registerBeanDefinitions(BeanDefinitionReader reader, Document doc, Resource resource) throws BeansException
XmlBeanDefinitionParser
registerBeanDefinitions
in interface XmlBeanDefinitionParser
reader
- the bean definition reader, containing the bean factory
to work on and the bean class loader to use. Can also be used to load
further bean definition files referenced by the given document.doc
- the DOM documentresource
- descriptor of the original XML resource
(useful for displaying parse errors)
BeansException
- in case of parsing errorsprotected BeanDefinitionReader getBeanDefinitionReader()
protected String getDefaultLazyInit()
protected String getDefaultDependencyCheck()
protected String getDefaultAutowire()
protected Resource getResource()
protected void importBeanDefinitionResource(Element ele)
protected BeanDefinitionHolder parseBeanDefinition(Element ele)
Bean elements specify their canonical name as "id" attribute and their aliases as a delimited "name" attribute.
If no "id" specified, uses the first name in the "name" attribute as canonical name, registering all others as aliases.
protected BeanDefinition parseBeanDefinition(Element ele, String beanName)
protected ConstructorArgumentValues getConstructorArgSubElements(Element beanEle, String beanName) throws ClassNotFoundException
ClassNotFoundException
protected MutablePropertyValues getPropertyValueSubElements(Element beanEle, String beanName)
protected void getLookupOverrideSubElements(Element beanEle, String beanName, MethodOverrides overrides)
protected void getReplacedMethodSubElements(Element beanEle, String beanName, MethodOverrides overrides)
protected void parseConstructorArgElement(Element ele, String beanName, ConstructorArgumentValues cargs) throws DOMException, ClassNotFoundException
DOMException
ClassNotFoundException
protected void parsePropertyElement(Element ele, String beanName, MutablePropertyValues pvs)
protected Object getPropertyValue(Element ele, String beanName, String propertyName)
protected Object parsePropertySubelement(Element ele, String beanName)
ele
- subelement of property element; we don't know which yetprotected List getList(Element collectionEle, String beanName)
protected Set getSet(Element collectionEle, String beanName)
protected Map getMap(Element mapEle, String beanName)
protected List getChildElementsByTagName(Element mapEle, String elementName)
protected Properties getProps(Element propsEle, String beanName)
protected String getTextValue(Element ele, String beanName)
protected int getDependencyCheck(String att)
protected int getAutowireMode(String att)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |