Class MethodInvoker
java.lang.Object
org.springframework.binding.method.MethodInvoker
A helper for invoking typed methods on arbitrary objects, with support for argument value type conversion from values
retrieved from an argument attribute source, and conversion of the result to a desired type.
- Author:
- Keith Donald, Jeremy Grelle
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected ObjectapplyTypeConversion(Object value, Class<?> targetType) Apply type conversion on the supplied valueinvoke(MethodSignature signature, Object bean, Object argumentSource) Invoke the method on the bean provided.voidsetConversionService(ConversionService conversionService) Sets the conversion service to convert argument values as needed.
-
Constructor Details
-
MethodInvoker
public MethodInvoker()
-
-
Method Details
-
setConversionService
Sets the conversion service to convert argument values as needed. -
invoke
public Object invoke(MethodSignature signature, Object bean, 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 typesbean- the bean to invokeargumentSource- the source for method arguments- Returns:
- the invoked method's return value
- Throws:
MethodInvocationException- the method could not be invoked
-
applyTypeConversion
Apply type conversion on the supplied value- Parameters:
value- the raw value to be convertedtargetType- the target type for the conversion- Returns:
- the converted result
-