Overview | Package | Class | Tree | Deprecated | Index | Help
| Spring Framework
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.springframework.web.method.support
Class InvocableHandlerMethod

    java.lang.Object
      org.springframework.web.method.HandlerMethod
          org.springframework.web.method.support.InvocableHandlerMethod

Direct Known Subclasses:
  ServletInvocableHandlerMethod

    public class InvocableHandlerMethod

extends HandlerMethod

Provides a method for invoking the handler method for a given request after resolving its method argument values through registered `HandlerMethodArgumentResolver`s.

Argument resolution often requires a `WebDataBinder` for data binding or for type conversion. Use the `setDataBinderFactory(WebDataBinderFactory)` property to supply a binder factory to pass to argument resolvers.

Use `setHandlerMethodArgumentResolvers(HandlerMethodArgumentResolverComposite)` to customize the list of argument resolvers.

Since:
  3.1
Author:
  Rossen Stoyanchev

Field Summary

Fields inherited from class org.springframework.web.method.HandlerMethod
`logger`

Constructor Summary
`InvocableHandlerMethod(java.lang.Object bean, java.lang.reflect.Method method)` Constructs a new handler method with the given bean instance and method.
`InvocableHandlerMethod(java.lang.Object bean, java.lang.String methodName, java.lang.Class<?>... parameterTypes)` Constructs a new handler method with the given bean instance, method name and parameters.

Method Summary
`protected java.lang.String` | `getDetailedErrorMessage(java.lang.String message)` Adds HandlerMethod details such as the controller type and method signature to the given error message.
`java.lang.Object` | `invokeForRequest(NativeWebRequest request, ModelAndViewContainer mavContainer, java.lang.Object... providedArgs)` Invoke the method after resolving its argument values in the context of the given request.
`void` | `setDataBinderFactory(WebDataBinderFactory dataBinderFactory)` Sets the `WebDataBinderFactory` to be passed to argument resolvers allowing them to create a `WebDataBinder` for data binding and type conversion purposes.
`void` | `setHandlerMethodArgumentResolvers(HandlerMethodArgumentResolverComposite argumentResolvers)` Set `HandlerMethodArgumentResolver`s to use to use for resolving method argument values.
`void` | `setParameterNameDiscoverer(ParameterNameDiscoverer parameterNameDiscoverer)` Set the ParameterNameDiscoverer for resolving parameter names when needed (e.g.

Methods inherited from class org.springframework.web.method.HandlerMethod
`createWithResolvedBean, equals, getBean, getBeanType, getBridgedMethod, getMethod, getMethodAnnotation, getMethodParameters, getReturnType, getReturnValueType, hashCode, isVoid, toString`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### InvocableHandlerMethod

    public InvocableHandlerMethod(java.lang.Object bean,
                                  java.lang.reflect.Method method)

  Constructs a new handler method with the given bean instance and method.

  Parameters:
    `bean` - the bean instance
    `method` - the method

### InvocableHandlerMethod

    public InvocableHandlerMethod(java.lang.Object bean,
                                  java.lang.String methodName,
                                  java.lang.Class<?>... parameterTypes)
                           throws java.lang.NoSuchMethodException

  Constructs a new handler method with the given bean instance, method name and parameters.

  Parameters:
    `bean` - the object bean
    `methodName` - the method name
    `parameterTypes` - the method parameter types
  Throws:
    `java.lang.NoSuchMethodException` - when the method cannot be found

Method Detail

### setDataBinderFactory

    public void setDataBinderFactory(WebDataBinderFactory dataBinderFactory)

  Sets the `WebDataBinderFactory` to be passed to argument resolvers allowing them to create a `WebDataBinder` for data binding and type conversion purposes.

  Parameters:
    `dataBinderFactory` - the data binder factory.

### setHandlerMethodArgumentResolvers

    public void setHandlerMethodArgumentResolvers(HandlerMethodArgumentResolverComposite argumentResolvers)

  Set `HandlerMethodArgumentResolver`s to use to use for resolving method argument values.

### setParameterNameDiscoverer

    public void setParameterNameDiscoverer(ParameterNameDiscoverer parameterNameDiscoverer)

  Set the ParameterNameDiscoverer for resolving parameter names when needed (e.g. default request attribute name).

  Default is an `LocalVariableTableParameterNameDiscoverer` instance.

### invokeForRequest

    public final java.lang.Object invokeForRequest(NativeWebRequest request,
                                                   ModelAndViewContainer mavContainer,
                                                   java.lang.Object... providedArgs)
                                            throws java.lang.Exception

  Invoke the method after resolving its argument values in the context of the given request.

  Argument values are commonly resolved through `HandlerMethodArgumentResolver`s. The `provideArgs` parameter however may supply argument values to be used directly, i.e. without argument resolution. Examples of provided argument values include a `WebDataBinder`, a `SessionStatus`, or a thrown exception instance. Provided argument values are checked before argument resolvers.

  Parameters:
    `request` - the current request
    `mavContainer` - the ModelAndViewContainer for this request
    `providedArgs` - "given" arguments matched by type, not resolved
  Returns:
    the raw value returned by the invoked method
  Throws:
    `java.lang.Exception` - raised if no suitable argument resolver can be found, or the method raised an exception

### getDetailedErrorMessage

    protected java.lang.String getDetailedErrorMessage(java.lang.String message)

  Adds HandlerMethod details such as the controller type and method signature to the given error message.

  Parameters:
    `message` - error message to append the HandlerMethod details to

Overview | Package | Class | Tree | Deprecated | Index | Help
| Spring Framework
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD