Class HandlerMethodArgumentResolverComposite
java.lang.Object
org.springframework.messaging.handler.invocation.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:
- 4.0
- Author:
- Rossen Stoyanchev, Juergen Hoeller
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddResolver
(HandlerMethodArgumentResolver resolver) Add the givenHandlerMethodArgumentResolver
.addResolvers
(List<? extends HandlerMethodArgumentResolver> resolvers) Add the givenHandlerMethodArgumentResolvers
.addResolvers
(HandlerMethodArgumentResolver... resolvers) Add the givenHandlerMethodArgumentResolvers
.void
clear()
Clear the list of configured resolvers and the resolver cache.Return a read-only list with the contained resolvers, or an empty list.resolveArgument
(MethodParameter parameter, Message<?> message) Iterate over registeredHandlerMethodArgumentResolvers
and invoke the one that supports it.boolean
supportsParameter
(MethodParameter parameter) Whether the given method parameter is supported by any registeredHandlerMethodArgumentResolver
.
-
Constructor Details
-
HandlerMethodArgumentResolverComposite
public HandlerMethodArgumentResolverComposite()
-
-
Method Details
-
addResolver
Add the givenHandlerMethodArgumentResolver
. -
addResolvers
public HandlerMethodArgumentResolverComposite addResolvers(@Nullable HandlerMethodArgumentResolver... resolvers) Add the givenHandlerMethodArgumentResolvers
.- Since:
- 4.3
-
addResolvers
public HandlerMethodArgumentResolverComposite addResolvers(@Nullable List<? extends HandlerMethodArgumentResolver> resolvers) Add the givenHandlerMethodArgumentResolvers
. -
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. -
supportsParameter
Whether the given method parameter is supported by any registeredHandlerMethodArgumentResolver
.- Specified by:
supportsParameter
in interfaceHandlerMethodArgumentResolver
- Parameters:
parameter
- the method parameter to check- Returns:
true
if this resolver supports the supplied parameter;false
otherwise
-
resolveArgument
@Nullable public Object resolveArgument(MethodParameter parameter, Message<?> message) throws Exception Iterate over registeredHandlerMethodArgumentResolvers
and invoke the one that supports it.- Specified by:
resolveArgument
in interfaceHandlerMethodArgumentResolver
- Parameters:
parameter
- the method parameter to resolve. This parameter must have previously been passed toHandlerMethodArgumentResolver.supportsParameter(org.springframework.core.MethodParameter)
which must have returnedtrue
.message
- the currently processed message- Returns:
- the resolved argument value, or
null
- Throws:
IllegalArgumentException
- if no suitable argument resolver is foundException
- in case of errors with the preparation of argument values
-