Skip to content

Commit f99b2f1

Browse files
committed
Document all remaining public methods on BeanDefinitionParserDelegate
Closes gh-23349
1 parent 379e919 commit f99b2f1

File tree

1 file changed

+64
-12
lines changed

1 file changed

+64
-12
lines changed

spring-beans/src/main/java/org/springframework/beans/factory/xml/BeanDefinitionParserDelegate.java

Lines changed: 64 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -673,6 +673,9 @@ protected AbstractBeanDefinition createBeanDefinition(String className, String p
673673
parentName, className, this.readerContext.getBeanClassLoader());
674674
}
675675

676+
/**
677+
* Parse the meta elements underneath the given element, if any.
678+
*/
676679
public void parseMetaElements(Element ele, BeanMetadataAttributeAccessor attributeAccessor) {
677680
NodeList nl = ele.getChildNodes();
678681
for (int i = 0; i < nl.getLength(); i++) {
@@ -688,23 +691,27 @@ public void parseMetaElements(Element ele, BeanMetadataAttributeAccessor attribu
688691
}
689692
}
690693

694+
/**
695+
* Parse the given autowire attribute value into
696+
* {@link AbstractBeanDefinition} autowire constants.
697+
*/
691698
@SuppressWarnings("deprecation")
692-
public int getAutowireMode(String attValue) {
693-
String att = attValue;
694-
if (isDefaultValue(att)) {
695-
att = this.defaults.getAutowire();
699+
public int getAutowireMode(String attrValue) {
700+
String attr = attrValue;
701+
if (isDefaultValue(attr)) {
702+
attr = this.defaults.getAutowire();
696703
}
697704
int autowire = AbstractBeanDefinition.AUTOWIRE_NO;
698-
if (AUTOWIRE_BY_NAME_VALUE.equals(att)) {
705+
if (AUTOWIRE_BY_NAME_VALUE.equals(attr)) {
699706
autowire = AbstractBeanDefinition.AUTOWIRE_BY_NAME;
700707
}
701-
else if (AUTOWIRE_BY_TYPE_VALUE.equals(att)) {
708+
else if (AUTOWIRE_BY_TYPE_VALUE.equals(attr)) {
702709
autowire = AbstractBeanDefinition.AUTOWIRE_BY_TYPE;
703710
}
704-
else if (AUTOWIRE_CONSTRUCTOR_VALUE.equals(att)) {
711+
else if (AUTOWIRE_CONSTRUCTOR_VALUE.equals(attr)) {
705712
autowire = AbstractBeanDefinition.AUTOWIRE_CONSTRUCTOR;
706713
}
707-
else if (AUTOWIRE_AUTODETECT_VALUE.equals(att)) {
714+
else if (AUTOWIRE_AUTODETECT_VALUE.equals(attr)) {
708715
autowire = AbstractBeanDefinition.AUTOWIRE_AUTODETECT;
709716
}
710717
// Else leave default value.
@@ -1001,6 +1008,12 @@ else if (subElement != null) {
10011008
}
10021009
}
10031010

1011+
/**
1012+
* Parse a value, ref or collection sub-element of a property or
1013+
* constructor-arg element.
1014+
* @param ele subelement of property element; we don't know which yet
1015+
* @param bd the current bean definition (if any)
1016+
*/
10041017
public Object parsePropertySubElement(Element ele, BeanDefinition bd) {
10051018
return parsePropertySubElement(ele, bd, null);
10061019
}
@@ -1009,6 +1022,7 @@ public Object parsePropertySubElement(Element ele, BeanDefinition bd) {
10091022
* Parse a value, ref or collection sub-element of a property or
10101023
* constructor-arg element.
10111024
* @param ele subelement of property element; we don't know which yet
1025+
* @param bd the current bean definition (if any)
10121026
* @param defaultValueType the default type (class name) for any
10131027
* {@code <value>} tag that might be created
10141028
*/
@@ -1396,10 +1410,21 @@ public boolean parseMergeAttribute(Element collectionElement) {
13961410
return TRUE_VALUE.equals(value);
13971411
}
13981412

1413+
/**
1414+
* Parse a custom element (outside of the default namespace).
1415+
* @param ele the element to parse
1416+
* @return the resulting bean definition
1417+
*/
13991418
public BeanDefinition parseCustomElement(Element ele) {
14001419
return parseCustomElement(ele, null);
14011420
}
14021421

1422+
/**
1423+
* Parse a custom element (outside of the default namespace).
1424+
* @param ele the element to parse
1425+
* @param containingBd the containing bean definition (if any)
1426+
* @return the resulting bean definition
1427+
*/
14031428
public BeanDefinition parseCustomElement(Element ele, BeanDefinition containingBd) {
14041429
String namespaceUri = getNamespaceURI(ele);
14051430
NamespaceHandler handler = this.readerContext.getNamespaceHandlerResolver().resolve(namespaceUri);
@@ -1410,14 +1435,27 @@ public BeanDefinition parseCustomElement(Element ele, BeanDefinition containingB
14101435
return handler.parse(ele, new ParserContext(this.readerContext, this, containingBd));
14111436
}
14121437

1413-
public BeanDefinitionHolder decorateBeanDefinitionIfRequired(Element ele, BeanDefinitionHolder definitionHolder) {
1414-
return decorateBeanDefinitionIfRequired(ele, definitionHolder, null);
1438+
/**
1439+
* Decorate the given bean definition through a namespace handler, if applicable.
1440+
* @param ele the current element
1441+
* @param originalDef the current bean definition
1442+
* @return the decorated bean definition
1443+
*/
1444+
public BeanDefinitionHolder decorateBeanDefinitionIfRequired(Element ele, BeanDefinitionHolder originalDef) {
1445+
return decorateBeanDefinitionIfRequired(ele, originalDef, null);
14151446
}
14161447

1448+
/**
1449+
* Decorate the given bean definition through a namespace handler, if applicable.
1450+
* @param ele the current element
1451+
* @param originalDef the current bean definition
1452+
* @param containingBd the containing bean definition (if any)
1453+
* @return the decorated bean definition
1454+
*/
14171455
public BeanDefinitionHolder decorateBeanDefinitionIfRequired(
1418-
Element ele, BeanDefinitionHolder definitionHolder, BeanDefinition containingBd) {
1456+
Element ele, BeanDefinitionHolder originalDef, BeanDefinition containingBd) {
14191457

1420-
BeanDefinitionHolder finalDefinition = definitionHolder;
1458+
BeanDefinitionHolder finalDefinition = originalDef;
14211459

14221460
// Decorate based on custom attributes first.
14231461
NamedNodeMap attributes = ele.getAttributes();
@@ -1437,6 +1475,14 @@ public BeanDefinitionHolder decorateBeanDefinitionIfRequired(
14371475
return finalDefinition;
14381476
}
14391477

1478+
/**
1479+
* Decorate the given bean definition through a namespace handler,
1480+
* if applicable.
1481+
* @param node the current child node
1482+
* @param originalDef the current bean definition
1483+
* @param containingBd the containing bean definition (if any)
1484+
* @return the decorated bean definition
1485+
*/
14401486
public BeanDefinitionHolder decorateIfRequired(
14411487
Node node, BeanDefinitionHolder originalDef, BeanDefinition containingBd) {
14421488

@@ -1511,10 +1557,16 @@ public boolean nodeNameEquals(Node node, String desiredName) {
15111557
return desiredName.equals(node.getNodeName()) || desiredName.equals(getLocalName(node));
15121558
}
15131559

1560+
/**
1561+
* Determine whether the given URI indicates the default namespace.
1562+
*/
15141563
public boolean isDefaultNamespace(String namespaceUri) {
15151564
return (!StringUtils.hasLength(namespaceUri) || BEANS_NAMESPACE_URI.equals(namespaceUri));
15161565
}
15171566

1567+
/**
1568+
* Determine whether the given node indicates the default namespace.
1569+
*/
15181570
public boolean isDefaultNamespace(Node node) {
15191571
return isDefaultNamespace(getNamespaceURI(node));
15201572
}

0 commit comments

Comments
 (0)