public abstract class AbstractNamedValueMethodArgumentResolver extends Object implements HandlerMethodArgumentResolver
Subclasses define how to do the following:
A default value string can contain ${...} placeholders and Spring Expression
Language #{...} expressions. For this to work a
ConfigurableBeanFactory
must be supplied to the class constructor.
Modifier and Type | Class and Description |
---|---|
protected static class |
AbstractNamedValueMethodArgumentResolver.NamedValueInfo
Represents the information about a named value, including name, whether
it's required and a default value.
|
Constructor and Description |
---|
AbstractNamedValueMethodArgumentResolver(org.springframework.core.convert.ConversionService conversionService,
org.springframework.beans.factory.config.ConfigurableBeanFactory beanFactory) |
Modifier and Type | Method and Description |
---|---|
protected abstract AbstractNamedValueMethodArgumentResolver.NamedValueInfo |
createNamedValueInfo(org.springframework.core.MethodParameter parameter)
Create the
AbstractNamedValueMethodArgumentResolver.NamedValueInfo object for the given method parameter. |
protected void |
handleMissingValue(String name,
org.springframework.core.MethodParameter parameter)
Invoked when a named value is required, but
resolveName(String, MethodParameter, ServerWebExchange) returned
null and there is no default value. |
protected void |
handleMissingValue(String name,
org.springframework.core.MethodParameter parameter,
org.springframework.web.server.ServerWebExchange exchange)
Invoked when a named value is required, but
resolveName(String, MethodParameter, ServerWebExchange) returned
null and there is no default value. |
protected void |
handleResolvedValue(Object arg,
String name,
org.springframework.core.MethodParameter parameter,
org.springframework.ui.ModelMap model,
org.springframework.web.server.ServerWebExchange exchange)
Invoked after a value is resolved.
|
reactor.core.publisher.Mono<Object> |
resolveArgument(org.springframework.core.MethodParameter parameter,
org.springframework.ui.ModelMap model,
org.springframework.web.server.ServerWebExchange exchange)
The returned
Mono may produce one or zero values if the argument
does not resolve to any value, which will result in null passed
as the argument value. |
protected abstract reactor.core.publisher.Mono<Object> |
resolveName(String name,
org.springframework.core.MethodParameter parameter,
org.springframework.web.server.ServerWebExchange exchange)
Resolve the given parameter type and value name into an argument value.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
supportsParameter
public AbstractNamedValueMethodArgumentResolver(org.springframework.core.convert.ConversionService conversionService, org.springframework.beans.factory.config.ConfigurableBeanFactory beanFactory)
conversionService
- for type conversion (to be replaced with WebDataBinder)beanFactory
- a bean factory to use for resolving ${...} placeholder
and #{...} SpEL expressions in default values, or null
if default
values are not expected to contain expressionspublic reactor.core.publisher.Mono<Object> resolveArgument(org.springframework.core.MethodParameter parameter, org.springframework.ui.ModelMap model, org.springframework.web.server.ServerWebExchange exchange)
HandlerMethodArgumentResolver
Mono
may produce one or zero values if the argument
does not resolve to any value, which will result in null
passed
as the argument value.resolveArgument
in interface HandlerMethodArgumentResolver
parameter
- the method parametermodel
- the implicit model for request handlingexchange
- the current exchangeprotected abstract AbstractNamedValueMethodArgumentResolver.NamedValueInfo createNamedValueInfo(org.springframework.core.MethodParameter parameter)
AbstractNamedValueMethodArgumentResolver.NamedValueInfo
object for the given method parameter.
Implementations typically retrieve the method annotation by means of
MethodParameter.getParameterAnnotation(Class)
.parameter
- the method parameterprotected abstract reactor.core.publisher.Mono<Object> resolveName(String name, org.springframework.core.MethodParameter parameter, org.springframework.web.server.ServerWebExchange exchange)
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, org.springframework.core.MethodParameter parameter, org.springframework.web.server.ServerWebExchange exchange)
resolveName(String, MethodParameter, ServerWebExchange)
returned
null
and there is no default value. Subclasses typically throw an
exception in this case.name
- the name for the valueparameter
- the method parameterexchange
- the current exchangeprotected void handleMissingValue(String name, org.springframework.core.MethodParameter parameter)
resolveName(String, MethodParameter, ServerWebExchange)
returned
null
and there is no default value. Subclasses typically throw an
exception in this case.name
- the name for the valueparameter
- the method parameterprotected void handleResolvedValue(Object arg, String name, org.springframework.core.MethodParameter parameter, org.springframework.ui.ModelMap model, org.springframework.web.server.ServerWebExchange exchange)
arg
- the resolved argument valuename
- the argument nameparameter
- the argument parameter typemodel
- the modelexchange
- the current exchange