Top Description Fields Constructors Methods
org.springframework.beans.factory.xml

public Class BeanDefinitionParserDelegate

extends Object
Class Inheritance
Imports
java.util.ArrayList, .Arrays, .Collection, .HashSet, .List, .Map, .Properties, .Set, org.apache.commons.logging.Log, .LogFactory, org.w3c.dom.Element, .NamedNodeMap, .Node, .NodeList, org.springframework.beans.BeanMetadataAttribute, .BeanMetadataAttributeAccessor, .PropertyValue, org.springframework.beans.factory.config.BeanDefinition, .BeanDefinitionHolder, .ConstructorArgumentValues, .RuntimeBeanNameReference, .RuntimeBeanReference, .TypedStringValue, org.springframework.beans.factory.parsing.BeanEntry, .ConstructorArgumentEntry, .ParseState, .PropertyEntry, .QualifierEntry, org.springframework.beans.factory.support.AbstractBeanDefinition, .AutowireCandidateQualifier, .BeanDefinitionDefaults, .BeanDefinitionReaderUtils, .LookupOverride, .ManagedArray, .ManagedList, .ManagedMap, .ManagedProperties, .ManagedSet, .MethodOverrides, .ReplaceOverride, org.springframework.lang.Nullable, org.springframework.util.Assert, .ClassUtils, .CollectionUtils, .ObjectUtils, .PatternMatchUtils, .StringUtils, org.springframework.util.xml.DomUtils

Stateful delegate class used to parse XML bean definitions. Intended for use by both the main parser and any extension BeanDefinitionParsers or BeanDefinitionDecorators.
Authors
Rob Harrop, Juergen Hoeller, Rod Johnson, Mark Fisher, Gary Russell
Since
2.0
See Also
ParserContext, DefaultBeanDefinitionDocumentReader

Field Summary

Modifier and TypeField and Description
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
private final DocumentDefaultsDefinition
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
protected final Log
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
private final ParseState
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
private final XmlReaderContext
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
private static final String
public static final String
TRUE_VALUE

Value of a T/F attribute that represents true.

public static final String
private final Set<String>
usedNames

Stores all used bean names so we can enforce uniqueness on a per beans-element basis.

public static final String
public static final String
public static final String
public static final String

Constructor Summary

AccessConstructor and Description
public
BeanDefinitionParserDelegate(XmlReaderContext readerContext)

Create a new BeanDefinitionParserDelegate associated with the supplied XmlReaderContext.

Method Summary

Modifier and TypeMethod and Description
protected TypedStringValue
buildTypedStringValue(String value, String targetTypeName)

Build a typed String value Object for the given raw value.

protected final Object
buildTypedStringValueForMap(String value, String defaultTypeName, Element entryEle)

Build a typed String value Object for the given raw value.

protected void
checkNameUniqueness(String beanName, List<String> aliases, Element beanElement)

Validate that the specified bean name and aliases have not been used already within the current level of beans element nesting.

protected AbstractBeanDefinition

Returns:

the newly created bean definition
createBeanDefinition
(String
the name of the bean class
className
,
String
the name of the bean's parent bean
parentName
)

Create a bean definition for the given class name and parent name.

public BeanDefinitionHolder

Returns:

the decorated bean definition
decorateBeanDefinitionIfRequired
(Element
the current element
ele
,
BeanDefinitionHolder
the current bean definition
originalDef
)

Decorate the given bean definition through a namespace handler, if applicable.

public BeanDefinitionHolder

Returns:

the decorated bean definition
decorateBeanDefinitionIfRequired
(Element
the current element
ele
,
BeanDefinitionHolder
the current bean definition
originalDef
,
BeanDefinition
the containing bean definition (if any)
containingBd
)

Decorate the given bean definition through a namespace handler, if applicable.

public BeanDefinitionHolder

Returns:

the decorated bean definition
decorateIfRequired
(Node
the current child node
node
,
BeanDefinitionHolder
the current bean definition
originalDef
,
BeanDefinition
the containing bean definition (if any)
containingBd
)

Decorate the given bean definition through a namespace handler, if applicable.

protected void
error(String message, Node source)

Report an error with the given message for the given source element.

protected void
error(String message, Element source)

Report an error with the given message for the given source element.

protected void
error(String message, Element source, Throwable cause)

Report an error with the given message for the given source element.

protected Object
extractSource(Element ele)

Invoke the org.springframework.beans.factory.parsing.SourceExtractor to pull the source metadata from the supplied Element.

public String[]
getAutowireCandidatePatterns()

Return any patterns provided in the 'default-autowire-candidates' attribute of the top-level <beans/> element.

public int
getAutowireMode(String attrValue)

Parse the given autowire attribute value into AbstractBeanDefinition autowire constants.

public BeanDefinitionDefaults
getBeanDefinitionDefaults()

Return the default settings for bean definitions as indicated within the attributes of the top-level <beans/> element.

public DocumentDefaultsDefinition
getDefaults()

Return the defaults definition object.

public String
getLocalName(Node
the Node
node
)

Get the local name for the supplied Node.

public String
getNamespaceURI(Node
the node
node
)

Get the namespace URI for the supplied node.

public final XmlReaderContext
getReaderContext()

Get the XmlReaderContext associated with this helper instance.

public void
initDefaults(Element root)

Initialize the default settings assuming a null parent delegate.

public void
initDefaults(Element root, BeanDefinitionParserDelegate parent)

Initialize the default lazy-init, autowire, dependency check settings, init-method, destroy-method and merge settings.

private boolean
public boolean
isDefaultNamespace(String namespaceUri)

Determine whether the given URI indicates the default namespace.

public boolean
isDefaultNamespace(Node node)

Determine whether the given node indicates the default namespace.

private boolean
public boolean
nodeNameEquals(Node
the node to compare
node
,
String
the name to check for
desiredName
)

Determine whether the name of the supplied node is equal to the supplied name.

public Object
parseArrayElement(Element arrayEle, BeanDefinition bd)

Parse an array element.

public AbstractBeanDefinition

Returns:

a bean definition initialized according to the bean element attributes
parseBeanDefinitionAttributes
(Element
bean declaration element
ele
,
String
bean name
beanName
,
BeanDefinition
containing bean definition
containingBean
,
AbstractBeanDefinition bd)

Apply the attributes of the given bean element to the given bean * definition.

public BeanDefinitionHolder
parseBeanDefinitionElement(Element ele)

Parses the supplied <bean> element.

public BeanDefinitionHolder
parseBeanDefinitionElement(Element ele, BeanDefinition containingBean)

Parses the supplied <bean> element.

public AbstractBeanDefinition
parseBeanDefinitionElement(Element ele, String beanName, BeanDefinition containingBean)

Parse the bean definition itself, without regard to name or aliases.

protected void
parseCollectionElements(NodeList elementNodes, Collection<Object> target, BeanDefinition bd, String defaultElementType)

public void
parseConstructorArgElement(Element ele, BeanDefinition bd)

Parse a constructor-arg element.

public void
parseConstructorArgElements(Element beanEle, BeanDefinition bd)

Parse constructor-arg sub-elements of the given bean element.

public BeanDefinition

Returns:

the resulting bean definition
parseCustomElement
(Element
the element to parse
ele
)

Parse a custom element (outside the default namespace).

public BeanDefinition

Returns:

the resulting bean definition
parseCustomElement
(Element
the element to parse
ele
,
BeanDefinition
the containing bean definition (if any)
containingBd
)

Parse a custom element (outside the default namespace).

public Object
parseIdRefElement(Element ele)

Return a typed String value Object for the given 'idref' element.

protected Object
parseKeyElement(Element keyEle, BeanDefinition bd, String defaultKeyTypeName)

Parse a key sub-element of a map element.

public List<Object>
parseListElement(Element collectionEle, BeanDefinition bd)

Parse a list element.

public void
parseLookupOverrideSubElements(Element beanEle, MethodOverrides overrides)

Parse lookup-override sub-elements of the given bean element.

public Map<Object, Object>
parseMapElement(Element mapEle, BeanDefinition bd)

Parse a map element.

public boolean
parseMergeAttribute(Element collectionElement)

Parse the merge attribute of a collection element, if any.

public void
parseMetaElements(Element ele, BeanMetadataAttributeAccessor attributeAccessor)

Parse the meta elements underneath the given element, if any.

private BeanDefinitionHolder
public void
parsePropertyElement(Element ele, BeanDefinition bd)

Parse a property element.

public void
parsePropertyElements(Element beanEle, BeanDefinition bd)

Parse property sub-elements of the given bean element.

public Object
parsePropertySubElement(Element
subelement of property element; we don't know which yet
ele
,
BeanDefinition
the current bean definition (if any)
bd
)

Parse a value, ref or collection sub-element of a property or constructor-arg element.

public Object
parsePropertySubElement(Element
subelement of property element; we don't know which yet
ele
,
BeanDefinition
the current bean definition (if any)
bd
,
String
the default type (class name) for any <value> tag that might be created
defaultValueType
)

Parse a value, ref or collection sub-element of a property or constructor-arg element.

public Object
parsePropertyValue(Element ele, BeanDefinition bd, String propertyName)

Get the value of a property element.

public Properties
parsePropsElement(Element propsEle)

Parse a props element.

public void
parseQualifierElement(Element ele, AbstractBeanDefinition bd)

Parse a qualifier element.

public void
parseQualifierElements(Element beanEle, AbstractBeanDefinition bd)

Parse qualifier sub-elements of the given bean element.

public void
parseReplacedMethodSubElements(Element beanEle, MethodOverrides overrides)

Parse replaced-method sub-elements of the given bean element.

public Set<Object>
parseSetElement(Element collectionEle, BeanDefinition bd)

Parse a set element.

public Object
parseValueElement(Element ele, String defaultTypeName)

Return a typed String value Object for the given value element.

protected void
populateDefaults(DocumentDefaultsDefinition
the defaults to populate
defaults
,
DocumentDefaultsDefinition
the parent BeanDefinitionParserDelegate (if any) defaults to fall back to
parentDefaults
,
Element
the root element of the current bean definition document (or nested beans element)
root
)

Populate the given DocumentDefaultsDefinition instance with the default lazy-init, autowire, dependency check settings, init-method, destroy-method and merge settings.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait