org.springframework.binding.method
Class MethodInvoker

java.lang.Object
  extended by org.springframework.binding.method.MethodInvoker

public class MethodInvoker
extends java.lang.Object

A helper for invoking typed methods on abritrary objects, with support for argument value type conversion from values retrieved from a argument attribute source.

Author:
Keith Donald

Constructor Summary
MethodInvoker()
           
 
Method Summary
protected  java.lang.Object applyTypeConversion(java.lang.Object parameterValue, java.lang.Class targetType)
          Apply type conversion on the event parameter if neccessary
 java.lang.Object invoke(MethodSignature signature, java.lang.Object bean, java.lang.Object argumentSource)
          Invoke the method on the bean provided.
 void setConversionService(ConversionService conversionService)
          Sets the conversion service to convert argument values as needed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MethodInvoker

public MethodInvoker()
Method Detail

setConversionService

public void setConversionService(ConversionService conversionService)
Sets the conversion service to convert argument values as needed.


invoke

public java.lang.Object invoke(MethodSignature signature,
                               java.lang.Object bean,
                               java.lang.Object argumentSource)
                        throws MethodInvocationException
Invoke the method on the bean provided. Argument values are pulled from the provided argument source.

Parameters:
signature - the definition of the method to invoke, including the method name and the method argument types
bean - the bean to invoke
argumentSource - the source for method arguments
Returns:
the invoked method's return value
Throws:
MethodInvocationException - the method could not be invoked

applyTypeConversion

protected java.lang.Object applyTypeConversion(java.lang.Object parameterValue,
                                               java.lang.Class targetType)
Apply type conversion on the event parameter if neccessary

Parameters:
parameterValue - the raw argument value
targetType - the target type for the matching method argument
Returns:
the converted method argument


Copyright � 2004-2007. All Rights Reserved.