站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > Spring Framework 2.1.0 API 文档英文版

ArgumentConvertingMethodInvoker (Spring Framework API 2.1) - Spring Framework 2.1.0 API 文档英文版


The Spring Framework

org.springframework.beans.support
Class ArgumentConvertingMethodInvoker

java.lang.Object
  extended by org.springframework.util.MethodInvoker
      extended by org.springframework.beans.support.ArgumentConvertingMethodInvoker
Direct Known Subclasses:
MethodInvokingFactoryBean, MethodInvokingJobDetailFactoryBean, MethodInvokingRunnable

public class ArgumentConvertingMethodInvoker
extends MethodInvoker

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

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

Since:
1.1
Author:
Juergen Hoeller
See Also:
BeanWrapperImpl.convertIfNecessary(java.lang.Object, java.lang.Class)

Constructor Summary
ArgumentConvertingMethodInvoker()
           
 
Method Summary
protected  Method findMatchingMethod()
          This implementation looks for a method with matching parameter types: that is, where each argument value is assignable to the corresponding parameter type.
protected  TypeConverter getDefaultTypeConverter()
          Obtain the default TypeConverter for this method invoker.
 TypeConverter getTypeConverter()
          Return the TypeConverter used for argument type conversion.
 void registerCustomEditor(Class requiredType, PropertyEditor propertyEditor)
          Register the given custom property editor for all properties of the given type.
 void setTypeConverter(TypeConverter typeConverter)
          Set a TypeConverter to use for argument type conversion.
 
Methods inherited from class org.springframework.util.MethodInvoker
getArguments, getPreparedMethod, getTargetClass, getTargetMethod, getTargetObject, invoke, isPrepared, prepare, resolveClassName, setArguments, setStaticMethod, setTargetClass, setTargetMethod, setTargetObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArgumentConvertingMethodInvoker

public ArgumentConvertingMethodInvoker()
Method Detail

setTypeConverter

public void setTypeConverter(TypeConverter typeConverter)
Set a TypeConverter to use for argument type conversion.

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

See Also:
SimpleTypeConverter, BeanWrapperImpl

getTypeConverter

public TypeConverter getTypeConverter()
Return the TypeConverter used for argument type conversion.

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


getDefaultTypeConverter

protected TypeConverter getDefaultTypeConverter()
Obtain the default TypeConverter for this method invoker.

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


registerCustomEditor

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 SimpleTypeConverter; will work with any TypeConverter that implements the PropertyEditorRegistry interface as well.

Parameters:
requiredType - type of the property
propertyEditor - editor to register
See Also:
setTypeConverter(org.springframework.beans.TypeConverter), PropertyEditorRegistry.registerCustomEditor(java.lang.Class, java.beans.PropertyEditor)

findMatchingMethod

protected Method findMatchingMethod()
This implementation looks for a method with matching parameter types: that is, where each argument value is assignable to the corresponding parameter type.

Overrides:
findMatchingMethod in class MethodInvoker
Returns:
a matching method, or null if none
See Also:
MethodInvoker.getTargetClass(), MethodInvoker.getTargetMethod(), MethodInvoker.getArguments()

The Spring Framework

Copyright © 2002-2007 The Spring Framework.