类 RuntimeBeanReference
- java.lang.Object
- org.springframework.beans.factory.config.RuntimeBeanReference
- 所有已实现的接口:
BeanMetadataElement,BeanReference
public class RuntimeBeanReference extends Object implements BeanReference
Immutable placeholder class used for a property value object when it's a reference to another bean in the factory, to be resolved at runtime.- 作者:
- Rod Johnson, Juergen Hoeller
- 另请参阅:
BeanDefinition.getPropertyValues(),BeanFactory.getBean(String),BeanFactory.getBean(Class)
构造器概要
构造器 构造器 说明 RuntimeBeanReference(Class<?> beanType)Create a new RuntimeBeanReference to a bean of the given type.RuntimeBeanReference(Class<?> beanType, boolean toParent)Create a new RuntimeBeanReference to a bean of the given type, with the option to mark it as reference to a bean in the parent factory.RuntimeBeanReference(String beanName)Create a new RuntimeBeanReference to the given bean name.RuntimeBeanReference(String beanName, boolean toParent)Create a new RuntimeBeanReference to the given bean name, with the option to mark it as reference to a bean in the parent factory.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 booleanequals(Object other)StringgetBeanName()Return the requested bean name, or the fully-qualified type name in case of by-type resolution.Class<?>getBeanType()Return the requested bean type if resolution by type is demanded.ObjectgetSource()Return the configuration sourceObjectfor this metadata element (may benull).inthashCode()booleanisToParent()Return whether this is an explicit reference to a bean in the parent factory.voidsetSource(Object source)Set the configuration sourceObjectfor this metadata element.StringtoString()
构造器详细资料
RuntimeBeanReference
public RuntimeBeanReference(String beanName)
Create a new RuntimeBeanReference to the given bean name.- 参数:
beanName- name of the target bean
RuntimeBeanReference
public RuntimeBeanReference(String beanName, boolean toParent)
Create a new RuntimeBeanReference to the given bean name, with the option to mark it as reference to a bean in the parent factory.- 参数:
beanName- name of the target beantoParent- whether this is an explicit reference to a bean in the parent factory
RuntimeBeanReference
public RuntimeBeanReference(Class<?> beanType)
Create a new RuntimeBeanReference to a bean of the given type.- 参数:
beanType- type of the target bean- 从以下版本开始:
- 5.2
RuntimeBeanReference
public RuntimeBeanReference(Class<?> beanType, boolean toParent)
Create a new RuntimeBeanReference to a bean of the given type, with the option to mark it as reference to a bean in the parent factory.- 参数:
beanType- type of the target beantoParent- whether this is an explicit reference to a bean in the parent factory- 从以下版本开始:
- 5.2
方法详细资料
getBeanName
public String getBeanName()
Return the requested bean name, or the fully-qualified type name in case of by-type resolution.- 指定者:
getBeanName在接口中BeanReference- 另请参阅:
getBeanType()
getBeanType
@Nullable public Class<?> getBeanType()
Return the requested bean type if resolution by type is demanded.- 从以下版本开始:
- 5.2
isToParent
public boolean isToParent()
Return whether this is an explicit reference to a bean in the parent factory.
setSource
public void setSource(@Nullable Object source)
Set the configuration sourceObjectfor this metadata element.The exact type of the object will depend on the configuration mechanism used.
getSource
@Nullable public Object getSource()
从接口复制的说明:BeanMetadataElementReturn the configuration sourceObjectfor this metadata element (may benull).- 指定者:
getSource在接口中BeanMetadataElement