Class RuntimeBeanReference
- java.lang.Object
- org.springframework.beans.factory.config.RuntimeBeanReference
- All Implemented Interfaces:
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.- Author:
- Rod Johnson, Juergen Hoeller
- See Also:
BeanDefinition.getPropertyValues()
,BeanFactory.getBean(java.lang.String)
Constructor Summary
Constructors Constructor Description RuntimeBeanReference(String beanName)
Create a new RuntimeBeanReference to the given bean name, without explicitly marking it as reference to a bean in the parent factory.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.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object other)
String
getBeanName()
Return the target bean name that this reference points to (nevernull
).Object
getSource()
Return the configuration sourceObject
for this metadata element (may benull
).int
hashCode()
boolean
isToParent()
Return whether this is an explicit reference to a bean in the parent factory.void
setSource(Object source)
Set the configuration sourceObject
for this metadata element.String
toString()
Constructor Detail
RuntimeBeanReference
public RuntimeBeanReference(String beanName)
Create a new RuntimeBeanReference to the given bean name, without explicitly marking it as reference to a bean in the parent factory.- Parameters:
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.- Parameters:
beanName
- name of the target beantoParent
- whether this is an explicit reference to a bean in the parent factory
Method Detail
getBeanName
public String getBeanName()
Description copied from interface:BeanReference
Return the target bean name that this reference points to (nevernull
).- Specified by:
getBeanName
in interfaceBeanReference
isToParent
public boolean isToParent()
Return whether this is an explicit reference to a bean in the parent factory.
setSource
public void setSource(Object source)
Set the configuration sourceObject
for this metadata element.The exact type of the object will depend on the configuration mechanism used.
getSource
public Object getSource()
Description copied from interface:BeanMetadataElement
Return the configuration sourceObject
for this metadata element (may benull
).- Specified by:
getSource
in interfaceBeanMetadataElement