Class HandlerMethodArgumentResolverComposite
java.lang.Object
org.springframework.graphql.data.method.HandlerMethodArgumentResolverComposite
- All Implemented Interfaces:
HandlerMethodArgumentResolver
public class HandlerMethodArgumentResolverComposite
extends Object
implements HandlerMethodArgumentResolver
Container for a list of resolvers that looks for one that supports a given
method parameter type, and delegates to it.
- Since:
- 1.0.0
- Author:
- Rossen Stoyanchev
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addResolver
(HandlerMethodArgumentResolver resolver) Add the givenHandlerMethodArgumentResolver
.getArgumentResolver
(MethodParameter parameter) Find a registeredHandlerMethodArgumentResolver
that supports the given method parameter.Return a read-only list with the contained resolvers, or an empty list.resolveArgument
(MethodParameter parameter, DataFetchingEnvironment environment) 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
.- Parameters:
resolver
- the argument resolver
-
getResolvers
Return a read-only list with the contained resolvers, or an empty list. -
supportsParameter
Whether the given method parameter is supported by any registeredHandlerMethodArgumentResolver
.- Specified by:
supportsParameter
in interfaceHandlerMethodArgumentResolver
- Parameters:
parameter
- the method parameter to check for support
-
resolveArgument
@Nullable public Object resolveArgument(MethodParameter parameter, DataFetchingEnvironment environment) 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 checked viaHandlerMethodArgumentResolver.supportsParameter(org.springframework.core.MethodParameter)
.environment
- the environment to use to resolve the value- Returns:
- the resolved value, which may be
null
if not resolved; the value may also be aMono
if it requires asynchronous resolution. - Throws:
IllegalArgumentException
- if no suitable argument resolver is foundException
- in case of errors with the preparation of argument values
-
getArgumentResolver
Find a registeredHandlerMethodArgumentResolver
that supports the given method parameter.- Parameters:
parameter
- the method parameter
-