public abstract class AbstractNamedValueArgumentResolver extends HandlerMethodArgumentResolverSupport
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 |
AbstractNamedValueArgumentResolver.NamedValueInfo
Represents the information about a named value, including name, whether
it's required and a default value.
|
logger
Constructor and Description |
---|
AbstractNamedValueArgumentResolver(ConfigurableBeanFactory factory,
ReactiveAdapterRegistry registry)
Create a new
AbstractNamedValueArgumentResolver instance. |
Modifier and Type | Method and Description |
---|---|
protected abstract AbstractNamedValueArgumentResolver.NamedValueInfo |
createNamedValueInfo(MethodParameter parameter)
Create the
AbstractNamedValueArgumentResolver.NamedValueInfo object for the given method parameter. |
protected void |
handleMissingValue(String name,
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,
MethodParameter parameter,
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,
MethodParameter parameter,
Model model,
ServerWebExchange exchange)
Invoked after a value is resolved.
|
reactor.core.publisher.Mono<Object> |
resolveArgument(MethodParameter parameter,
BindingContext bindingContext,
ServerWebExchange exchange)
Resolve the value for the method parameter.
|
protected abstract reactor.core.publisher.Mono<Object> |
resolveName(String name,
MethodParameter parameter,
ServerWebExchange exchange)
Resolve the given parameter type and value name into an argument value.
|
checkAnnotatedParamNoReactiveWrapper, checkParameterType, checkParameterTypeNoReactiveWrapper, getAdapterRegistry
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
supportsParameter
public AbstractNamedValueArgumentResolver(@Nullable ConfigurableBeanFactory factory, ReactiveAdapterRegistry registry)
AbstractNamedValueArgumentResolver
instance.factory
- a bean factory to use for resolving ${...}
placeholder
and #{...}
SpEL expressions in default values, or null
if default
values are not expected to contain expressionsregistry
- for checking reactive type wrapperspublic reactor.core.publisher.Mono<Object> resolveArgument(MethodParameter parameter, BindingContext bindingContext, ServerWebExchange exchange)
HandlerMethodArgumentResolver
parameter
- the method parameterbindingContext
- the binding context to useexchange
- the current exchangeMono
for the argument value, possibly emptyprotected abstract AbstractNamedValueArgumentResolver.NamedValueInfo createNamedValueInfo(MethodParameter parameter)
AbstractNamedValueArgumentResolver.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, MethodParameter parameter, 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 exchangeMono
)protected void handleMissingValue(String name, MethodParameter parameter, 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, 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(@Nullable Object arg, String name, MethodParameter parameter, Model model, ServerWebExchange exchange)
arg
- the resolved argument valuename
- the argument nameparameter
- the argument parameter typemodel
- the modelexchange
- the current exchange