Class AbstractNamedValueArgumentResolver
java.lang.Object
org.springframework.web.service.invoker.AbstractNamedValueArgumentResolver
- All Implemented Interfaces:
HttpServiceArgumentResolver
- Direct Known Subclasses:
CookieValueArgumentResolver
,MultipartFileArgumentResolver
,PathVariableArgumentResolver
,RequestAttributeArgumentResolver
,RequestHeaderArgumentResolver
,RequestParamArgumentResolver
,RequestPartArgumentResolver
public abstract class AbstractNamedValueArgumentResolver
extends Object
implements HttpServiceArgumentResolver
Base class for arguments that resolve to a named request value such as a
request header, path variable, cookie, and others.
- Since:
- 6.0
- Author:
- Rossen Stoyanchev
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static class
Info about a request value, typically extracted from a method parameter annotation. -
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
Constructor for a resolver to an Object value, without conversion.protected
AbstractNamedValueArgumentResolver
(ConversionService conversionService) Constructor for a resolver to a String value. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract void
addRequestValue
(String name, Object value, MethodParameter parameter, HttpRequestValues.Builder requestValues) Add the given, single request value.protected abstract AbstractNamedValueArgumentResolver.NamedValueInfo
createNamedValueInfo
(MethodParameter parameter) Return information about the request value, ornull
if the parameter does not represent a request value of interest.boolean
resolve
(Object argument, MethodParameter parameter, HttpRequestValues.Builder requestValues) Resolve the argument value.
-
Field Details
-
logger
-
-
Constructor Details
-
AbstractNamedValueArgumentResolver
Constructor for a resolver to a String value.- Parameters:
conversionService
- theConversionService
to use to format Object to String values
-
AbstractNamedValueArgumentResolver
protected AbstractNamedValueArgumentResolver()Constructor for a resolver to an Object value, without conversion.
-
-
Method Details
-
resolve
public boolean resolve(@Nullable Object argument, MethodParameter parameter, HttpRequestValues.Builder requestValues) Description copied from interface:HttpServiceArgumentResolver
Resolve the argument value.- Specified by:
resolve
in interfaceHttpServiceArgumentResolver
- Parameters:
argument
- the argument valueparameter
- the method parameter for the argumentrequestValues
- builder to add HTTP request values to- Returns:
true
if the argument was resolved,false
otherwise
-
createNamedValueInfo
@Nullable protected abstract AbstractNamedValueArgumentResolver.NamedValueInfo createNamedValueInfo(MethodParameter parameter) Return information about the request value, ornull
if the parameter does not represent a request value of interest. -
addRequestValue
protected abstract void addRequestValue(String name, Object value, MethodParameter parameter, HttpRequestValues.Builder requestValues) Add the given, single request value. This may be called multiples times if the request value is multivalued.If the resolver was created with a
ConversionService
, the value will have been converted to a String and may be cast down.- Parameters:
name
- the request value namevalue
- the valueparameter
- the method parameter type, nested if Map, List/array, or OptionalrequestValues
- builder to add the request value to
-