org.springframework.web.method.support

## Class HandlerMethodArgumentResolverComposite

- java.lang.Object
- - org.springframework.web.method.support.HandlerMethodArgumentResolverComposite

- All Implemented Interfaces:
    HandlerMethodArgumentResolver

      public class HandlerMethodArgumentResolverComposite
      extends Object
      implements HandlerMethodArgumentResolver

  Resolves method parameters by delegating to a list of registered `HandlerMethodArgumentResolver`s. Previously resolved method parameters are cached for faster lookups.
  Since:
    3.1
  Author:
    Rossen Stoyanchev

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Log` | `logger`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `HandlerMethodArgumentResolverComposite()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `HandlerMethodArgumentResolverComposite` | `addResolver(HandlerMethodArgumentResolver argumentResolver)` Add the given `HandlerMethodArgumentResolver`.
    `HandlerMethodArgumentResolverComposite` | `addResolvers(List<? extends HandlerMethodArgumentResolver> argumentResolvers)` Add the given `HandlerMethodArgumentResolver`s.
    `List<HandlerMethodArgumentResolver>` | `getResolvers()` Return a read-only list with the contained resolvers, or an empty list.
    `Object` | `resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer, NativeWebRequest webRequest, WebDataBinderFactory binderFactory)` Iterate over registered `HandlerMethodArgumentResolver`s and invoke the one that supports it.
    `boolean` | `supportsParameter(MethodParameter parameter)` Whether the given method parameter is supported by any registered `HandlerMethodArgumentResolver`.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### logger

          protected final Log logger

  - ### Constructor Detail

    - #### HandlerMethodArgumentResolverComposite

          public HandlerMethodArgumentResolverComposite()

  - ### Method Detail

    - #### getResolvers

          public List<HandlerMethodArgumentResolver> getResolvers()

      Return a read-only list with the contained resolvers, or an empty list.

    - #### supportsParameter

          public boolean supportsParameter(MethodParameter parameter)

      Whether the given method parameter is supported by any registered `HandlerMethodArgumentResolver`.
      Specified by:
        `supportsParameter` in interface `HandlerMethodArgumentResolver`
      Parameters:
        `parameter` - the method parameter to check
      Returns:
        `true` if this resolver supports the supplied parameter; `false` otherwise

    - #### resolveArgument

          public Object resolveArgument(MethodParameter parameter,
                               ModelAndViewContainer mavContainer,
                               NativeWebRequest webRequest,
                               WebDataBinderFactory binderFactory)
                                 throws Exception

      Iterate over registered `HandlerMethodArgumentResolver`s and invoke the one that supports it.
      Specified by:
        `resolveArgument` in interface `HandlerMethodArgumentResolver`
      Parameters:
        `parameter` - the method parameter to resolve. This parameter must have previously been passed to `HandlerMethodArgumentResolver.supportsParameter(org.springframework.core.MethodParameter)` and it must have returned `true`
        `mavContainer` - the ModelAndViewContainer for the current request
        `webRequest` - the current request
        `binderFactory` - a factory for creating `WebDataBinder` instances
      Returns:
        the resolved argument value, or `null`.
      Throws:
        `IllegalStateException` - if no suitable `HandlerMethodArgumentResolver` is found.
        `Exception` - in case of errors with the preparation of argument values

    - #### addResolver

          public HandlerMethodArgumentResolverComposite addResolver(HandlerMethodArgumentResolver argumentResolver)

      Add the given `HandlerMethodArgumentResolver`.

    - #### addResolvers

          public HandlerMethodArgumentResolverComposite addResolvers(List<? extends HandlerMethodArgumentResolver> argumentResolvers)

      Add the given `HandlerMethodArgumentResolver`s.