Top Description Fields Constructors Methods
org.springframework.beans.support

public Class ArgumentConvertingMethodInvoker

extends MethodInvoker
Class Inheritance
Known Direct Subclasses
org.springframework.beans.factory.config.MethodInvokingBean
Imports
java.beans.PropertyEditor, java.lang.reflect.Method, org.springframework.beans.PropertyEditorRegistry, .SimpleTypeConverter, .TypeConverter, .TypeMismatchException, org.springframework.lang.Nullable, org.springframework.util.Assert, .MethodInvoker, .ReflectionUtils

Subclass of MethodInvoker that tries to convert the given arguments for the actual target method via a TypeConverter.

Supports flexible argument conversions, in particular for invoking a specific overloaded method.

Author
Juergen Hoeller
Since
1.1
See Also
org.springframework.beans.BeanWrapperImpl#convertIfNecessary

Field Summary

Modifier and TypeField and Description
private TypeConverter
private boolean
Inherited from org.springframework.util.MethodInvoker:
targetClass

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected Method

Returns:

a matching method, or null if none
doFindMatchingMethod
(Object[]
the argument values to match against method parameters
arguments
)

Actually find a method with matching parameter type, i.e. where each argument value is assignable to the corresponding parameter type.

protected Method
findMatchingMethod()

Overrides org.springframework.util.MethodInvoker.findMatchingMethod.

This implementation looks for a method with matching parameter types.
protected TypeConverter
getDefaultTypeConverter()

Obtain the default TypeConverter for this method invoker.

public TypeConverter
getTypeConverter()

Return the TypeConverter used for argument type conversion.

public void
registerCustomEditor(Class<?>
type of the property
requiredType
,
PropertyEditor
editor to register
propertyEditor
)

Register the given custom property editor for all properties of the given type.

public void
setTypeConverter(TypeConverter typeConverter)

Set a TypeConverter to use for argument type conversion.

Inherited from org.springframework.util.MethodInvoker:
getArgumentsgetPreparedMethodgetTargetClassgetTargetMethodgetTargetObjectgetTypeDifferenceWeightinvokeisPreparedprepareresolveClassNamesetArgumentssetStaticMethodsetTargetClasssetTargetMethodsetTargetObject

Field Detail

typeConverterback to summary
private TypeConverter typeConverter
Annotations
@Nullable
useDefaultConverterback to summary
private boolean useDefaultConverter

Constructor Detail

ArgumentConvertingMethodInvokerback to summary
public ArgumentConvertingMethodInvoker()

Method Detail

doFindMatchingMethodback to summary
protected Method doFindMatchingMethod(Object[] arguments)

Actually find a method with matching parameter type, i.e. where each argument value is assignable to the corresponding parameter type.

Parameters
arguments:Object[]

the argument values to match against method parameters

Returns:Method

a matching method, or null if none

Annotations
@Nullable
findMatchingMethodback to summary
protected Method findMatchingMethod()

Overrides org.springframework.util.MethodInvoker.findMatchingMethod.

This implementation looks for a method with matching parameter types.

Returns:Method

Doc from org.springframework.util.MethodInvoker.findMatchingMethod.

a matching method, or null if none

Annotations
@Override
@Nullable
See Also
doFindMatchingMethod
getDefaultTypeConverterback to summary
protected TypeConverter getDefaultTypeConverter()

Obtain the default TypeConverter for this method invoker.

Called if no explicit TypeConverter has been specified. The default implementation builds a org.springframework.beans.SimpleTypeConverter. Can be overridden in subclasses.

getTypeConverterback to summary
public TypeConverter getTypeConverter()

Return the TypeConverter used for argument type conversion.

Can be cast to org.springframework.beans.PropertyEditorRegistry if direct access to the underlying PropertyEditors is desired (provided that the present TypeConverter actually implements the PropertyEditorRegistry interface).

Annotations
@Nullable
registerCustomEditorback to summary
public void registerCustomEditor(Class<?> requiredType, PropertyEditor propertyEditor)

Register the given custom property editor for all properties of the given type.

Typically used in conjunction with the default org.springframework.beans.SimpleTypeConverter; will work with any TypeConverter that implements the PropertyEditorRegistry interface as well.

Parameters
requiredType:Class<?>

type of the property

propertyEditor:PropertyEditor

editor to register

See Also
setTypeConverter, org.springframework.beans.PropertyEditorRegistry#registerCustomEditor
setTypeConverterback to summary
public void setTypeConverter(TypeConverter typeConverter)

Set a TypeConverter to use for argument type conversion.

Default is a org.springframework.beans.SimpleTypeConverter. Can be overridden with any TypeConverter implementation, typically a pre-configured SimpleTypeConverter or a BeanWrapperImpl instance.

See Also
org.springframework.beans.SimpleTypeConverter, org.springframework.beans.BeanWrapperImpl