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.
| Constructor: |
public BeanDefinitionHolder(BeanDefinitionHolder beanDefinitionHolder) {
Assert.notNull(beanDefinitionHolder, "BeanDefinitionHolder must not be null");
this.beanDefinition = beanDefinitionHolder.getBeanDefinition();
this.beanName = beanDefinitionHolder.getBeanName();
this.aliases = beanDefinitionHolder.getAliases();
}
Parameters:
beanDefinitionHolder - the BeanDefinitionHolder to copy
|
public BeanDefinitionHolder(BeanDefinition beanDefinition,
String beanName) {
this(beanDefinition, beanName, null);
}
Create a new BeanDefinitionHolder. Parameters:
beanDefinition - the BeanDefinition to wrap
beanName - the name of the bean, as specified for the bean definition
|
public BeanDefinitionHolder(BeanDefinition beanDefinition,
String beanName,
String[] aliases) {
Assert.notNull(beanDefinition, "BeanDefinition must not be null");
Assert.notNull(beanName, "Bean name must not be null");
this.beanDefinition = beanDefinition;
this.beanName = beanName;
this.aliases = aliases;
}
Create a new BeanDefinitionHolder. Parameters:
beanDefinition - the BeanDefinition to wrap
beanName - the name of the bean, as specified for the bean definition
aliases - alias names for the bean, or null if none
|
| Method from org.springframework.beans.factory.config.BeanDefinitionHolder Detail: |
public boolean equals(Object other) {
if (this == other) {
return true;
}
if (!(other instanceof BeanDefinitionHolder)) {
return false;
}
BeanDefinitionHolder otherHolder = (BeanDefinitionHolder) other;
return this.beanDefinition.equals(otherHolder.beanDefinition) &&
this.beanName.equals(otherHolder.beanName) &&
ObjectUtils.nullSafeEquals(this.aliases, otherHolder.aliases);
}
|
public String[] getAliases() {
return this.aliases;
}
Return the alias names for the bean, as specified directly for the bean definition. |
public BeanDefinition getBeanDefinition() {
return this.beanDefinition;
}
Return the wrapped BeanDefinition. |
public String getBeanName() {
return this.beanName;
}
Return the primary name of the bean, as specified for the bean definition. |
public String getLongDescription() {
StringBuffer sb = new StringBuffer(getShortDescription());
sb.append(": ").append(this.beanDefinition);
return sb.toString();
}
Return a long description for the bean, including name and aliases
as well as a description of the contained BeanDefinition . |
public String getShortDescription() {
StringBuffer sb = new StringBuffer();
sb.append("Bean definition with name '").append(this.beanName).append("'");
if (this.aliases != null) {
sb.append(" and aliases [").append(StringUtils.arrayToCommaDelimitedString(this.aliases)).append("]");
}
return sb.toString();
}
Return a friendly, short description for the bean, stating name and aliases. |
public Object getSource() {
return this.beanDefinition.getSource();
}
Expose the bean definition's source object. |
public int hashCode() {
int hashCode = this.beanDefinition.hashCode();
hashCode = 29 * hashCode + this.beanName.hashCode();
hashCode = 29 * hashCode + ObjectUtils.nullSafeHashCode(this.aliases);
return hashCode;
}
|
public String toString() {
return getLongDescription();
}
This implementation returns the long description. Can be overridden
to return the short description or any kind of custom description instead. |