类 AbstractWebArgumentResolverAdapter
- java.lang.Object
- org.springframework.web.method.annotation.AbstractWebArgumentResolverAdapter
- 所有已实现的接口:
HandlerMethodArgumentResolver
public abstract class AbstractWebArgumentResolverAdapter extends Object implements HandlerMethodArgumentResolver
An abstract base class adapting aWebArgumentResolver
to theHandlerMethodArgumentResolver
contract.Note: This class is provided for backwards compatibility. However it is recommended to re-write a
WebArgumentResolver
asHandlerMethodArgumentResolver
. SincesupportsParameter(org.springframework.core.MethodParameter)
can only be implemented by actually resolving the value and then checking the result is notWebArgumentResolver#UNRESOLVED
any exceptions raised must be absorbed and ignored since it's not clear whether the adapter doesn't support the parameter or whether it failed for an internal reason. TheHandlerMethodArgumentResolver
contract also provides access to model attributes and toWebDataBinderFactory
(for type conversion).- 从以下版本开始:
- 3.1
- 作者:
- Arjen Poutsma, Rossen Stoyanchev
构造器概要
构造器 构造器 说明 AbstractWebArgumentResolverAdapter(WebArgumentResolver adaptee)
Create a new instance.
方法概要
所有方法 实例方法 抽象方法 具体方法 修饰符和类型 方法 说明 protected abstract NativeWebRequest
getWebRequest()
Required for access to NativeWebRequest insupportsParameter(org.springframework.core.MethodParameter)
.Object
resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer, NativeWebRequest webRequest, WebDataBinderFactory binderFactory)
Delegate to theWebArgumentResolver
instance.boolean
supportsParameter(MethodParameter parameter)
Actually resolve the value and check the resolved value is notWebArgumentResolver.UNRESOLVED
absorbing _any_ exceptions.
构造器详细资料
AbstractWebArgumentResolverAdapter
public AbstractWebArgumentResolverAdapter(WebArgumentResolver adaptee)
Create a new instance.
方法详细资料
supportsParameter
public boolean supportsParameter(MethodParameter parameter)
Actually resolve the value and check the resolved value is notWebArgumentResolver.UNRESOLVED
absorbing _any_ exceptions.- 指定者:
supportsParameter
在接口中HandlerMethodArgumentResolver
- 参数:
parameter
- the method parameter to check- 返回:
true
if this resolver supports the supplied parameter;false
otherwise
resolveArgument
@Nullable public Object resolveArgument(MethodParameter parameter, @Nullable ModelAndViewContainer mavContainer, NativeWebRequest webRequest, @Nullable WebDataBinderFactory binderFactory) throws Exception
Delegate to theWebArgumentResolver
instance.- 指定者:
resolveArgument
在接口中HandlerMethodArgumentResolver
- 参数:
parameter
- the method parameter to resolve. This parameter must have previously been passed toHandlerMethodArgumentResolver.supportsParameter(org.springframework.core.MethodParameter)
which must have returnedtrue
.mavContainer
- the ModelAndViewContainer for the current requestwebRequest
- the current requestbinderFactory
- a factory for creatingWebDataBinder
instances- 返回:
- the resolved argument value, or
null
if not resolvable - 抛出:
IllegalStateException
- if the resolved value is not assignable to the method parameter.Exception
- in case of errors with the preparation of argument values
getWebRequest
protected abstract NativeWebRequest getWebRequest()
Required for access to NativeWebRequest insupportsParameter(org.springframework.core.MethodParameter)
.