parent
d9d84ff388
commit
3d297b10e9
|
@ -17,6 +17,7 @@
|
||||||
package org.springframework.beans.factory.config;
|
package org.springframework.beans.factory.config;
|
||||||
|
|
||||||
import org.springframework.beans.factory.NamedBean;
|
import org.springframework.beans.factory.NamedBean;
|
||||||
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A simple holder for a given bean name plus bean instance.
|
* A simple holder for a given bean name plus bean instance.
|
||||||
|
@ -34,20 +35,26 @@ public class NamedBeanHolder<T> implements NamedBean {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new holder for the given bean name plus instance.
|
* Create a new holder for the given bean name plus instance.
|
||||||
|
* @param beanName the name of the bean
|
||||||
|
* @param beanInstance the corresponding bean instance
|
||||||
*/
|
*/
|
||||||
public NamedBeanHolder(String beanName, T beanInstance) {
|
public NamedBeanHolder(String beanName, T beanInstance) {
|
||||||
|
Assert.notNull(beanName, "Bean name must not be null");
|
||||||
this.beanName = beanName;
|
this.beanName = beanName;
|
||||||
this.beanInstance = beanInstance;
|
this.beanInstance = beanInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the name of the bean (never {@code null}).
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String getBeanName() {
|
public String getBeanName() {
|
||||||
return this.beanName;
|
return this.beanName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the corresponding bean instance.
|
* Return the corresponding bean instance (can be {@code null}).
|
||||||
*/
|
*/
|
||||||
public T getBeanInstance() {
|
public T getBeanInstance() {
|
||||||
return this.beanInstance;
|
return this.beanInstance;
|
||||||
|
|
Loading…
Reference in New Issue