类 AbstractNamedValueArgumentResolver
- java.lang.Object
- org.springframework.web.reactive.result.method.HandlerMethodArgumentResolverSupport
- org.springframework.web.reactive.result.method.annotation.AbstractNamedValueArgumentResolver
- 所有已实现的接口:
HandlerMethodArgumentResolver
public abstract class AbstractNamedValueArgumentResolver extends HandlerMethodArgumentResolverSupport
Abstract base class for resolving method arguments from a named value. Request parameters, request headers, and path variables are examples of named values. Each may have a name, a required flag, and a default value.Subclasses define how to do the following:
- Obtain named value information for a method parameter
- Resolve names into argument values
- Handle missing argument values when argument values are required
- Optionally handle a resolved value
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.- 从以下版本开始:
- 5.0
- 作者:
- Rossen Stoyanchev
嵌套类概要
嵌套类 修饰符和类型 类 说明 protected static class
AbstractNamedValueArgumentResolver.NamedValueInfo
Represents the information about a named value, including name, whether it's required and a default value.
字段概要
从类继承的字段 org.springframework.web.reactive.result.method.HandlerMethodArgumentResolverSupport
logger
构造器概要
构造器 构造器 说明 AbstractNamedValueArgumentResolver(ConfigurableBeanFactory factory, ReactiveAdapterRegistry registry)
Create a newAbstractNamedValueArgumentResolver
instance.
方法概要
所有方法 实例方法 抽象方法 具体方法 修饰符和类型 方法 说明 protected abstract AbstractNamedValueArgumentResolver.NamedValueInfo
createNamedValueInfo(MethodParameter parameter)
Create theAbstractNamedValueArgumentResolver.NamedValueInfo
object for the given method parameter.protected void
handleMissingValue(String name, MethodParameter parameter)
Invoked when a named value is required, butresolveName(String, MethodParameter, ServerWebExchange)
returnednull
and there is no default value.protected void
handleMissingValue(String name, MethodParameter parameter, ServerWebExchange exchange)
Invoked when a named value is required, butresolveName(String, MethodParameter, ServerWebExchange)
returnednull
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.从类继承的方法 org.springframework.web.reactive.result.method.HandlerMethodArgumentResolverSupport
checkAnnotatedParamNoReactiveWrapper, checkParameterType, checkParameterTypeNoReactiveWrapper, getAdapterRegistry
从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
从接口继承的方法 org.springframework.web.reactive.result.method.HandlerMethodArgumentResolver
supportsParameter
构造器详细资料
AbstractNamedValueArgumentResolver
public AbstractNamedValueArgumentResolver(@Nullable ConfigurableBeanFactory factory, ReactiveAdapterRegistry registry)
Create a newAbstractNamedValueArgumentResolver
instance.- 参数:
factory
- a bean factory to use for resolving${...}
placeholder and#{...}
SpEL expressions in default values, ornull
if default values are not expected to contain expressionsregistry
- for checking reactive type wrappers
方法详细资料
resolveArgument
public reactor.core.publisher.Mono<Object> resolveArgument(MethodParameter parameter, BindingContext bindingContext, ServerWebExchange exchange)
从接口复制的说明:HandlerMethodArgumentResolver
Resolve the value for the method parameter.- 参数:
parameter
- the method parameterbindingContext
- the binding context to useexchange
- the current exchange- 返回:
Mono
for the argument value, possibly empty
createNamedValueInfo
protected abstract AbstractNamedValueArgumentResolver.NamedValueInfo createNamedValueInfo(MethodParameter parameter)
Create theAbstractNamedValueArgumentResolver.NamedValueInfo
object for the given method parameter. Implementations typically retrieve the method annotation by means ofMethodParameter.getParameterAnnotation(Class)
.- 参数:
parameter
- the method parameter- 返回:
- the named value information
resolveName
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.- 参数:
name
- the name of the value being resolvedparameter
- the method parameter to resolve to an argument value (pre-nested in case of aOptional
declaration)exchange
- the current exchange- 返回:
- the resolved argument (may be empty
Mono
)
handleMissingValue
protected void handleMissingValue(String name, MethodParameter parameter, ServerWebExchange exchange)
Invoked when a named value is required, butresolveName(String, MethodParameter, ServerWebExchange)
returnednull
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 exchange
handleMissingValue
protected void handleMissingValue(String name, MethodParameter parameter)
Invoked when a named value is required, butresolveName(String, MethodParameter, ServerWebExchange)
returnednull
and there is no default value. Subclasses typically throw an exception in this case.- 参数:
name
- the name for the valueparameter
- the method parameter
handleResolvedValue
protected void handleResolvedValue(@Nullable Object arg, String name, MethodParameter parameter, Model model, ServerWebExchange exchange)
Invoked after a value is resolved.- 参数:
arg
- the resolved argument valuename
- the argument nameparameter
- the argument parameter typemodel
- the modelexchange
- the current exchange