Class ArgumentMethodArgumentResolver
java.lang.Object
org.springframework.graphql.data.method.annotation.support.ArgumentMethodArgumentResolver
- All Implemented Interfaces:
HandlerMethodArgumentResolver
Resolver for a method parameter that is annotated with
@Argument
. The specified raw argument value is obtained via
DataFetchingEnvironment.getArgument(String)
and bound to a higher
level object via GraphQlArgumentBinder
to match the target method
parameter type.
This resolver also supports wrapping the target object with
ArgumentValue
if the application wants to differentiate between an
input argument that was set to null
vs not provided at all. When
this wrapper type is used, the annotation is optional, and the name of the
argument is derived from the method parameter name.
An ArgumentValue
can also be nested within the object structure
of an @Argument
-annotated method parameter.
- Since:
- 1.0.0
- Author:
- Rossen Stoyanchev, Brian Clozel
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionresolveArgument
(MethodParameter parameter, DataFetchingEnvironment environment) Resolve a method parameter to a value.boolean
supportsParameter
(MethodParameter parameter) Whether this resolver supports the givenMethodParameter
.
-
Constructor Details
-
ArgumentMethodArgumentResolver
-
-
Method Details
-
supportsParameter
Description copied from interface:HandlerMethodArgumentResolver
Whether this resolver supports the givenMethodParameter
.- Specified by:
supportsParameter
in interfaceHandlerMethodArgumentResolver
-
resolveArgument
public Object resolveArgument(MethodParameter parameter, DataFetchingEnvironment environment) throws Exception Description copied from interface:HandlerMethodArgumentResolver
Resolve a method parameter to a value.- 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:
Exception
- in case of errors with the preparation of argument values
-