public class PathVariableMethodArgumentResolver extends AbstractNamedValueMethodArgumentResolver
PathVariable
.
An @PathVariable
is a named value that gets resolved from a URI
template variable. It is always required and does not have a default value
to fall back on. See the base class
AbstractNamedValueMethodArgumentResolver
for more information on how named values are processed.
If the method parameter type is Map
, the name specified in the
annotation is used to resolve the URI variable String value. The value is
then converted to a Map
via type conversion, assuming a suitable
Converter
.
PathVariableMapMethodArgumentResolver
AbstractNamedValueMethodArgumentResolver.NamedValueInfo
Constructor and Description |
---|
PathVariableMethodArgumentResolver(ConversionService conversionService,
ConfigurableBeanFactory beanFactory) |
Modifier and Type | Method and Description |
---|---|
protected AbstractNamedValueMethodArgumentResolver.NamedValueInfo |
createNamedValueInfo(MethodParameter parameter)
Create the
AbstractNamedValueMethodArgumentResolver.NamedValueInfo object for the given method parameter. |
protected void |
handleMissingValue(String name,
MethodParameter parameter)
Invoked when a named value is required, but
AbstractNamedValueMethodArgumentResolver.resolveName(String, MethodParameter, ServerWebExchange) returned
null and there is no default value. |
protected void |
handleResolvedValue(Object arg,
String name,
MethodParameter parameter,
ModelMap model,
ServerWebExchange exchange)
Invoked after a value is resolved.
|
protected reactor.core.publisher.Mono<Object> |
resolveName(String name,
MethodParameter parameter,
ServerWebExchange exchange)
Resolve the given parameter type and value name into an argument value.
|
boolean |
supportsParameter(MethodParameter parameter) |
handleMissingValue, resolveArgument
public PathVariableMethodArgumentResolver(ConversionService conversionService, ConfigurableBeanFactory beanFactory)
public boolean supportsParameter(MethodParameter parameter)
protected AbstractNamedValueMethodArgumentResolver.NamedValueInfo createNamedValueInfo(MethodParameter parameter)
AbstractNamedValueMethodArgumentResolver
AbstractNamedValueMethodArgumentResolver.NamedValueInfo
object for the given method parameter.
Implementations typically retrieve the method annotation by means of
MethodParameter.getParameterAnnotation(Class)
.createNamedValueInfo
in class AbstractNamedValueMethodArgumentResolver
parameter
- the method parameterprotected reactor.core.publisher.Mono<Object> resolveName(String name, MethodParameter parameter, ServerWebExchange exchange)
AbstractNamedValueMethodArgumentResolver
resolveName
in class AbstractNamedValueMethodArgumentResolver
name
- the name of the value being resolvedparameter
- the method parameter to resolve to an argument value
(pre-nested in case of a Optional
declaration)exchange
- the current exchangenull
)protected void handleMissingValue(String name, MethodParameter parameter)
AbstractNamedValueMethodArgumentResolver
AbstractNamedValueMethodArgumentResolver.resolveName(String, MethodParameter, ServerWebExchange)
returned
null
and there is no default value. Subclasses typically throw an
exception in this case.handleMissingValue
in class AbstractNamedValueMethodArgumentResolver
name
- the name for the valueparameter
- the method parameterprotected void handleResolvedValue(Object arg, String name, MethodParameter parameter, ModelMap model, ServerWebExchange exchange)
AbstractNamedValueMethodArgumentResolver
handleResolvedValue
in class AbstractNamedValueMethodArgumentResolver
arg
- the resolved argument valuename
- the argument nameparameter
- the argument parameter typemodel
- the modelexchange
- the current exchange