@@ -673,6 +673,9 @@ protected AbstractBeanDefinition createBeanDefinition(String className, String p
673
673
parentName , className , this .readerContext .getBeanClassLoader ());
674
674
}
675
675
676
+ /**
677
+ * Parse the meta elements underneath the given element, if any.
678
+ */
676
679
public void parseMetaElements (Element ele , BeanMetadataAttributeAccessor attributeAccessor ) {
677
680
NodeList nl = ele .getChildNodes ();
678
681
for (int i = 0 ; i < nl .getLength (); i ++) {
@@ -688,23 +691,27 @@ public void parseMetaElements(Element ele, BeanMetadataAttributeAccessor attribu
688
691
}
689
692
}
690
693
694
+ /**
695
+ * Parse the given autowire attribute value into
696
+ * {@link AbstractBeanDefinition} autowire constants.
697
+ */
691
698
@ 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 ();
696
703
}
697
704
int autowire = AbstractBeanDefinition .AUTOWIRE_NO ;
698
- if (AUTOWIRE_BY_NAME_VALUE .equals (att )) {
705
+ if (AUTOWIRE_BY_NAME_VALUE .equals (attr )) {
699
706
autowire = AbstractBeanDefinition .AUTOWIRE_BY_NAME ;
700
707
}
701
- else if (AUTOWIRE_BY_TYPE_VALUE .equals (att )) {
708
+ else if (AUTOWIRE_BY_TYPE_VALUE .equals (attr )) {
702
709
autowire = AbstractBeanDefinition .AUTOWIRE_BY_TYPE ;
703
710
}
704
- else if (AUTOWIRE_CONSTRUCTOR_VALUE .equals (att )) {
711
+ else if (AUTOWIRE_CONSTRUCTOR_VALUE .equals (attr )) {
705
712
autowire = AbstractBeanDefinition .AUTOWIRE_CONSTRUCTOR ;
706
713
}
707
- else if (AUTOWIRE_AUTODETECT_VALUE .equals (att )) {
714
+ else if (AUTOWIRE_AUTODETECT_VALUE .equals (attr )) {
708
715
autowire = AbstractBeanDefinition .AUTOWIRE_AUTODETECT ;
709
716
}
710
717
// Else leave default value.
@@ -1001,6 +1008,12 @@ else if (subElement != null) {
1001
1008
}
1002
1009
}
1003
1010
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
+ */
1004
1017
public Object parsePropertySubElement (Element ele , BeanDefinition bd ) {
1005
1018
return parsePropertySubElement (ele , bd , null );
1006
1019
}
@@ -1009,6 +1022,7 @@ public Object parsePropertySubElement(Element ele, BeanDefinition bd) {
1009
1022
* Parse a value, ref or collection sub-element of a property or
1010
1023
* constructor-arg element.
1011
1024
* @param ele subelement of property element; we don't know which yet
1025
+ * @param bd the current bean definition (if any)
1012
1026
* @param defaultValueType the default type (class name) for any
1013
1027
* {@code <value>} tag that might be created
1014
1028
*/
@@ -1396,10 +1410,21 @@ public boolean parseMergeAttribute(Element collectionElement) {
1396
1410
return TRUE_VALUE .equals (value );
1397
1411
}
1398
1412
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
+ */
1399
1418
public BeanDefinition parseCustomElement (Element ele ) {
1400
1419
return parseCustomElement (ele , null );
1401
1420
}
1402
1421
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
+ */
1403
1428
public BeanDefinition parseCustomElement (Element ele , BeanDefinition containingBd ) {
1404
1429
String namespaceUri = getNamespaceURI (ele );
1405
1430
NamespaceHandler handler = this .readerContext .getNamespaceHandlerResolver ().resolve (namespaceUri );
@@ -1410,14 +1435,27 @@ public BeanDefinition parseCustomElement(Element ele, BeanDefinition containingB
1410
1435
return handler .parse (ele , new ParserContext (this .readerContext , this , containingBd ));
1411
1436
}
1412
1437
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 );
1415
1446
}
1416
1447
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
+ */
1417
1455
public BeanDefinitionHolder decorateBeanDefinitionIfRequired (
1418
- Element ele , BeanDefinitionHolder definitionHolder , BeanDefinition containingBd ) {
1456
+ Element ele , BeanDefinitionHolder originalDef , BeanDefinition containingBd ) {
1419
1457
1420
- BeanDefinitionHolder finalDefinition = definitionHolder ;
1458
+ BeanDefinitionHolder finalDefinition = originalDef ;
1421
1459
1422
1460
// Decorate based on custom attributes first.
1423
1461
NamedNodeMap attributes = ele .getAttributes ();
@@ -1437,6 +1475,14 @@ public BeanDefinitionHolder decorateBeanDefinitionIfRequired(
1437
1475
return finalDefinition ;
1438
1476
}
1439
1477
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
+ */
1440
1486
public BeanDefinitionHolder decorateIfRequired (
1441
1487
Node node , BeanDefinitionHolder originalDef , BeanDefinition containingBd ) {
1442
1488
@@ -1511,10 +1557,16 @@ public boolean nodeNameEquals(Node node, String desiredName) {
1511
1557
return desiredName .equals (node .getNodeName ()) || desiredName .equals (getLocalName (node ));
1512
1558
}
1513
1559
1560
+ /**
1561
+ * Determine whether the given URI indicates the default namespace.
1562
+ */
1514
1563
public boolean isDefaultNamespace (String namespaceUri ) {
1515
1564
return (!StringUtils .hasLength (namespaceUri ) || BEANS_NAMESPACE_URI .equals (namespaceUri ));
1516
1565
}
1517
1566
1567
+ /**
1568
+ * Determine whether the given node indicates the default namespace.
1569
+ */
1518
1570
public boolean isDefaultNamespace (Node node ) {
1519
1571
return isDefaultNamespace (getNamespaceURI (node ));
1520
1572
}
0 commit comments