Class LookupOverride
- java.lang.Object
- org.springframework.beans.factory.support.MethodOverride
- org.springframework.beans.factory.support.LookupOverride
- All Implemented Interfaces:
BeanMetadataElement
public class LookupOverride extends MethodOverride
Represents an override of a method that looks up an object in the same IoC context.Methods eligible for lookup override must not have arguments.
- Since:
- 1.1
- Author:
- Rod Johnson, Juergen Hoeller
Constructor Summary
Constructors Constructor Description LookupOverride(Method method, String beanName)Construct a new LookupOverride.LookupOverride(String methodName, String beanName)Construct a new LookupOverride.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object other)StringgetBeanName()Return the name of the bean that should be returned by this method.inthashCode()booleanmatches(Method method)Match the specified method byMethodreference or method name.StringtoString()Methods inherited from class org.springframework.beans.factory.support.MethodOverride
getMethodName, getSource, isOverloaded, setOverloaded, setSource
Constructor Detail
LookupOverride
public LookupOverride(String methodName, String beanName)
Construct a new LookupOverride.- Parameters:
methodName- the name of the method to overridebeanName- the name of the bean in the currentBeanFactorythat the overridden method should return (may benull)
LookupOverride
public LookupOverride(Method method, String beanName)
Construct a new LookupOverride.- Parameters:
method- the method to overridebeanName- the name of the bean in the currentBeanFactorythat the overridden method should return (may benull)
Method Detail
getBeanName
public String getBeanName()
Return the name of the bean that should be returned by this method.
matches
public boolean matches(Method method)
Match the specified method byMethodreference or method name.For backwards compatibility reasons, in a scenario with overloaded non-abstract methods of the given name, only the no-arg variant of a method will be turned into a container-driven lookup method.
In case of a provided
Method, only straight matches will be considered, usually demarcated by the@Lookupannotation.- Specified by:
matchesin classMethodOverride- Parameters:
method- the method to check- Returns:
- whether this override matches the given method
equals
public boolean equals(Object other)
- Overrides:
equalsin classMethodOverride
hashCode
public int hashCode()
- Overrides:
hashCodein classMethodOverride