Package 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 `HandlerMethodArgumentResolvers`. Previously resolved method parameters are cached for faster lookups.

Since:
  3.1
Author:
  Rossen Stoyanchev, Juergen Hoeller

## Constructor Summary

Constructors
Constructor
Description
`HandlerMethodArgumentResolverComposite()`

## Method Summary

Modifier and Type
Method
Description
`HandlerMethodArgumentResolverComposite`
`addResolver(HandlerMethodArgumentResolver resolver)`
Add the given `HandlerMethodArgumentResolver`.
`HandlerMethodArgumentResolverComposite`
`addResolvers(List<? extends HandlerMethodArgumentResolver> resolvers)`
Add the given `HandlerMethodArgumentResolvers`.
`HandlerMethodArgumentResolverComposite`
`addResolvers(HandlerMethodArgumentResolver... resolvers)`
Add the given `HandlerMethodArgumentResolvers`.
`void`
`clear()`
Clear the list of configured resolvers and the resolver cache.
`HandlerMethodArgumentResolver`
`getArgumentResolver(org.springframework.core.MethodParameter parameter)`
Find a registered `HandlerMethodArgumentResolver` that supports the given method parameter.
`List<HandlerMethodArgumentResolver>`
`getResolvers()`
Return a read-only list with the contained resolvers, or an empty list.
`Object`
`resolveArgument(org.springframework.core.MethodParameter parameter, ModelAndViewContainer mavContainer, NativeWebRequest webRequest, WebDataBinderFactory binderFactory)`
Iterate over registered `HandlerMethodArgumentResolvers` and invoke the one that supports it.
`boolean`
`supportsParameter(org.springframework.core.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`

## Constructor Details

### HandlerMethodArgumentResolverComposite

public HandlerMethodArgumentResolverComposite()

## Method Details

### addResolver

public HandlerMethodArgumentResolverComposite addResolver(HandlerMethodArgumentResolver resolver)
Add the given `HandlerMethodArgumentResolver`.

### addResolvers

public HandlerMethodArgumentResolverComposite addResolvers(@Nullable HandlerMethodArgumentResolver... resolvers)
Add the given `HandlerMethodArgumentResolvers`.

Since:
  4.3

### addResolvers

public HandlerMethodArgumentResolverComposite addResolvers(@Nullable List<? extends HandlerMethodArgumentResolver> resolvers)
Add the given `HandlerMethodArgumentResolvers`.

### getResolvers

public List<HandlerMethodArgumentResolver> getResolvers()
Return a read-only list with the contained resolvers, or an empty list.

### clear

public void clear()
Clear the list of configured resolvers and the resolver cache.

Since:
  4.3

### supportsParameter

public boolean supportsParameter(org.springframework.core.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

@Nullable public Object resolveArgument(org.springframework.core.MethodParameter parameter, @Nullable ModelAndViewContainer mavContainer, NativeWebRequest webRequest, @Nullable WebDataBinderFactory binderFactory) throws Exception
Iterate over registered `HandlerMethodArgumentResolvers` 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)` which 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` if not resolvable
Throws:
  `IllegalArgumentException` - if no suitable argument resolver is found
  `Exception` - in case of errors with the preparation of argument values

### getArgumentResolver

@Nullable public HandlerMethodArgumentResolver getArgumentResolver(org.springframework.core.MethodParameter parameter)
Find a registered `HandlerMethodArgumentResolver` that supports the given method parameter.