@@ -643,6 +643,9 @@ protected AbstractBeanDefinition createBeanDefinition(@Nullable String className
643
643
parentName , className , this .readerContext .getBeanClassLoader ());
644
644
}
645
645
646
+ /**
647
+ * Parse the meta elements underneath the given element, if any.
648
+ */
646
649
public void parseMetaElements (Element ele , BeanMetadataAttributeAccessor attributeAccessor ) {
647
650
NodeList nl = ele .getChildNodes ();
648
651
for (int i = 0 ; i < nl .getLength (); i ++) {
@@ -658,23 +661,27 @@ public void parseMetaElements(Element ele, BeanMetadataAttributeAccessor attribu
658
661
}
659
662
}
660
663
664
+ /**
665
+ * Parse the given autowire attribute value into
666
+ * {@link AbstractBeanDefinition} autowire constants.
667
+ */
661
668
@ SuppressWarnings ("deprecation" )
662
- public int getAutowireMode (String attValue ) {
663
- String att = attValue ;
664
- if (isDefaultValue (att )) {
665
- att = this .defaults .getAutowire ();
669
+ public int getAutowireMode (String attrValue ) {
670
+ String attr = attrValue ;
671
+ if (isDefaultValue (attr )) {
672
+ attr = this .defaults .getAutowire ();
666
673
}
667
674
int autowire = AbstractBeanDefinition .AUTOWIRE_NO ;
668
- if (AUTOWIRE_BY_NAME_VALUE .equals (att )) {
675
+ if (AUTOWIRE_BY_NAME_VALUE .equals (attr )) {
669
676
autowire = AbstractBeanDefinition .AUTOWIRE_BY_NAME ;
670
677
}
671
- else if (AUTOWIRE_BY_TYPE_VALUE .equals (att )) {
678
+ else if (AUTOWIRE_BY_TYPE_VALUE .equals (attr )) {
672
679
autowire = AbstractBeanDefinition .AUTOWIRE_BY_TYPE ;
673
680
}
674
- else if (AUTOWIRE_CONSTRUCTOR_VALUE .equals (att )) {
681
+ else if (AUTOWIRE_CONSTRUCTOR_VALUE .equals (attr )) {
675
682
autowire = AbstractBeanDefinition .AUTOWIRE_CONSTRUCTOR ;
676
683
}
677
- else if (AUTOWIRE_AUTODETECT_VALUE .equals (att )) {
684
+ else if (AUTOWIRE_AUTODETECT_VALUE .equals (attr )) {
678
685
autowire = AbstractBeanDefinition .AUTOWIRE_AUTODETECT ;
679
686
}
680
687
// Else leave default value.
@@ -953,6 +960,12 @@ else if (subElement != null) {
953
960
}
954
961
}
955
962
963
+ /**
964
+ * Parse a value, ref or collection sub-element of a property or
965
+ * constructor-arg element.
966
+ * @param ele subelement of property element; we don't know which yet
967
+ * @param bd the current bean definition (if any)
968
+ */
956
969
@ Nullable
957
970
public Object parsePropertySubElement (Element ele , @ Nullable BeanDefinition bd ) {
958
971
return parsePropertySubElement (ele , bd , null );
@@ -962,6 +975,7 @@ public Object parsePropertySubElement(Element ele, @Nullable BeanDefinition bd)
962
975
* Parse a value, ref or collection sub-element of a property or
963
976
* constructor-arg element.
964
977
* @param ele subelement of property element; we don't know which yet
978
+ * @param bd the current bean definition (if any)
965
979
* @param defaultValueType the default type (class name) for any
966
980
* {@code <value>} tag that might be created
967
981
*/
@@ -1347,11 +1361,22 @@ public boolean parseMergeAttribute(Element collectionElement) {
1347
1361
return TRUE_VALUE .equals (value );
1348
1362
}
1349
1363
1364
+ /**
1365
+ * Parse a custom element (outside of the default namespace).
1366
+ * @param ele the element to parse
1367
+ * @return the resulting bean definition
1368
+ */
1350
1369
@ Nullable
1351
1370
public BeanDefinition parseCustomElement (Element ele ) {
1352
1371
return parseCustomElement (ele , null );
1353
1372
}
1354
1373
1374
+ /**
1375
+ * Parse a custom element (outside of the default namespace).
1376
+ * @param ele the element to parse
1377
+ * @param containingBd the containing bean definition (if any)
1378
+ * @return the resulting bean definition
1379
+ */
1355
1380
@ Nullable
1356
1381
public BeanDefinition parseCustomElement (Element ele , @ Nullable BeanDefinition containingBd ) {
1357
1382
String namespaceUri = getNamespaceURI (ele );
@@ -1366,14 +1391,27 @@ public BeanDefinition parseCustomElement(Element ele, @Nullable BeanDefinition c
1366
1391
return handler .parse (ele , new ParserContext (this .readerContext , this , containingBd ));
1367
1392
}
1368
1393
1369
- public BeanDefinitionHolder decorateBeanDefinitionIfRequired (Element ele , BeanDefinitionHolder definitionHolder ) {
1370
- return decorateBeanDefinitionIfRequired (ele , definitionHolder , null );
1394
+ /**
1395
+ * Decorate the given bean definition through a namespace handler, if applicable.
1396
+ * @param ele the current element
1397
+ * @param originalDef the current bean definition
1398
+ * @return the decorated bean definition
1399
+ */
1400
+ public BeanDefinitionHolder decorateBeanDefinitionIfRequired (Element ele , BeanDefinitionHolder originalDef ) {
1401
+ return decorateBeanDefinitionIfRequired (ele , originalDef , null );
1371
1402
}
1372
1403
1404
+ /**
1405
+ * Decorate the given bean definition through a namespace handler, if applicable.
1406
+ * @param ele the current element
1407
+ * @param originalDef the current bean definition
1408
+ * @param containingBd the containing bean definition (if any)
1409
+ * @return the decorated bean definition
1410
+ */
1373
1411
public BeanDefinitionHolder decorateBeanDefinitionIfRequired (
1374
- Element ele , BeanDefinitionHolder definitionHolder , @ Nullable BeanDefinition containingBd ) {
1412
+ Element ele , BeanDefinitionHolder originalDef , @ Nullable BeanDefinition containingBd ) {
1375
1413
1376
- BeanDefinitionHolder finalDefinition = definitionHolder ;
1414
+ BeanDefinitionHolder finalDefinition = originalDef ;
1377
1415
1378
1416
// Decorate based on custom attributes first.
1379
1417
NamedNodeMap attributes = ele .getAttributes ();
@@ -1393,6 +1431,14 @@ public BeanDefinitionHolder decorateBeanDefinitionIfRequired(
1393
1431
return finalDefinition ;
1394
1432
}
1395
1433
1434
+ /**
1435
+ * Decorate the given bean definition through a namespace handler,
1436
+ * if applicable.
1437
+ * @param node the current child node
1438
+ * @param originalDef the current bean definition
1439
+ * @param containingBd the containing bean definition (if any)
1440
+ * @return the decorated bean definition
1441
+ */
1396
1442
public BeanDefinitionHolder decorateIfRequired (
1397
1443
Node node , BeanDefinitionHolder originalDef , @ Nullable BeanDefinition containingBd ) {
1398
1444
@@ -1473,10 +1519,16 @@ public boolean nodeNameEquals(Node node, String desiredName) {
1473
1519
return desiredName .equals (node .getNodeName ()) || desiredName .equals (getLocalName (node ));
1474
1520
}
1475
1521
1522
+ /**
1523
+ * Determine whether the given URI indicates the default namespace.
1524
+ */
1476
1525
public boolean isDefaultNamespace (@ Nullable String namespaceUri ) {
1477
1526
return (!StringUtils .hasLength (namespaceUri ) || BEANS_NAMESPACE_URI .equals (namespaceUri ));
1478
1527
}
1479
1528
1529
+ /**
1530
+ * Determine whether the given node indicates the default namespace.
1531
+ */
1480
1532
public boolean isDefaultNamespace (Node node ) {
1481
1533
return isDefaultNamespace (getNamespaceURI (node ));
1482
1534
}
0 commit comments