Class MethodOverride
- java.lang.Object
- org.springframework.beans.factory.support.MethodOverride
- All Implemented Interfaces:
BeanMetadataElement
- Direct Known Subclasses:
LookupOverride
,ReplaceOverride
public abstract class MethodOverride extends Object implements BeanMetadataElement
Object representing the override of a method on a managed object by the IoC container.Note that the override mechanism is not intended as a generic means of inserting crosscutting code: use AOP for that.
- Since:
- 1.1
- Author:
- Rod Johnson, Juergen Hoeller, Sam Brannen
Constructor Summary
Constructors Modifier Constructor Description protected
MethodOverride(String methodName)
Construct a new override for the given method.
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object other)
String
getMethodName()
Return the name of the method to be overridden.Object
getSource()
Return the configuration sourceObject
for this metadata element (may benull
).int
hashCode()
protected boolean
isOverloaded()
Return whether the overridden method is overloaded (i.e., whether argument type matching needs to occur to disambiguate methods of the same name).abstract boolean
matches(Method method)
Subclasses must override this to indicate whether they match the given method.protected void
setOverloaded(boolean overloaded)
Set whether the overridden method is overloaded (i.e., whether argument type matching needs to occur to disambiguate methods of the same name).void
setSource(Object source)
Set the configuration sourceObject
for this metadata element.
Constructor Detail
MethodOverride
protected MethodOverride(String methodName)
Construct a new override for the given method.- Parameters:
methodName
- the name of the method to override
Method Detail
getMethodName
public String getMethodName()
Return the name of the method to be overridden.
setOverloaded
protected void setOverloaded(boolean overloaded)
Set whether the overridden method is overloaded (i.e., whether argument type matching needs to occur to disambiguate methods of the same name).Default is
true
; can be switched tofalse
to optimize runtime performance.
isOverloaded
protected boolean isOverloaded()
Return whether the overridden method is overloaded (i.e., whether argument type matching needs to occur to disambiguate methods of the same name).
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
matches
public abstract boolean matches(Method method)
Subclasses must override this to indicate whether they match the given method. This allows for argument list checking as well as method name checking.- Parameters:
method
- the method to check- Returns:
- whether this override matches the given method