Class BeanDefinitionHolder
java.lang.Object
org.springframework.beans.factory.config.BeanDefinitionHolder
- All Implemented Interfaces:
BeanMetadataElement
- Direct Known Subclasses:
BeanComponentDefinition
Holder for a BeanDefinition with name and aliases.
Can be registered as a placeholder for an inner bean.
Can also be used for programmatic registration of inner bean definitions. If you don't care about BeanNameAware and the like, registering RootBeanDefinition or ChildBeanDefinition is good enough.
- Since:
- 1.0.2
- Author:
- Juergen Hoeller
- See Also:
-
Constructor Summary
ConstructorDescriptionBeanDefinitionHolder
(BeanDefinitionHolder beanDefinitionHolder) Copy constructor: Create a new BeanDefinitionHolder with the same contents as the given BeanDefinitionHolder instance.BeanDefinitionHolder
(BeanDefinition beanDefinition, String beanName) Create a new BeanDefinitionHolder.BeanDefinitionHolder
(BeanDefinition beanDefinition, String beanName, String @Nullable [] aliases) Create a new BeanDefinitionHolder. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Return the alias names for the bean, as specified directly for the bean definition.Return the wrapped BeanDefinition.Return the primary name of the bean, as specified for the bean definition.Return a long description for the bean, including name and aliases as well as a description of the containedBeanDefinition
.Return a friendly, short description for the bean, stating name and aliases.Expose the bean definition's source object.int
hashCode()
boolean
matchesName
(@Nullable String candidateName) Determine whether the given candidate name matches the bean name or the aliases stored in this bean definition.toString()
This implementation returns the long description.
-
Constructor Details
-
BeanDefinitionHolder
Create a new BeanDefinitionHolder.- Parameters:
beanDefinition
- the BeanDefinition to wrapbeanName
- the name of the bean, as specified for the bean definition
-
BeanDefinitionHolder
public BeanDefinitionHolder(BeanDefinition beanDefinition, String beanName, String @Nullable [] aliases) Create a new BeanDefinitionHolder.- Parameters:
beanDefinition
- the BeanDefinition to wrapbeanName
- the name of the bean, as specified for the bean definitionaliases
- alias names for the bean, ornull
if none
-
BeanDefinitionHolder
Copy constructor: Create a new BeanDefinitionHolder with the same contents as the given BeanDefinitionHolder instance.Note: The wrapped BeanDefinition reference is taken as-is; it is
not
deeply copied.- Parameters:
beanDefinitionHolder
- the BeanDefinitionHolder to copy
-
-
Method Details
-
getBeanDefinition
Return the wrapped BeanDefinition. -
getBeanName
Return the primary name of the bean, as specified for the bean definition. -
getAliases
Return the alias names for the bean, as specified directly for the bean definition.- Returns:
- the array of alias names, or
null
if none
-
getSource
Expose the bean definition's source object.- Specified by:
getSource
in interfaceBeanMetadataElement
- See Also:
-
matchesName
Determine whether the given candidate name matches the bean name or the aliases stored in this bean definition. -
getShortDescription
Return a friendly, short description for the bean, stating name and aliases.- See Also:
-
getLongDescription
Return a long description for the bean, including name and aliases as well as a description of the containedBeanDefinition
.- See Also:
-
toString
This implementation returns the long description. Can be overridden to return the short description or any kind of custom description instead. -
equals
-
hashCode
public int hashCode()
-