public abstract class AbstractWebArgumentResolverAdapter extends Object implements HandlerMethodArgumentResolver
WebArgumentResolver to the
HandlerMethodArgumentResolver contract.
Note: This class is provided for backwards compatibility.
However it is recommended to re-write a WebArgumentResolver as
HandlerMethodArgumentResolver. Since supportsParameter(org.springframework.core.MethodParameter)
can only be implemented by actually resolving the value and then checking
the result is not WebArgumentResolver#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.
The HandlerMethodArgumentResolver contract also provides access to
model attributes and to WebDataBinderFactory (for type conversion).
| Constructor and Description |
|---|
AbstractWebArgumentResolverAdapter(WebArgumentResolver adaptee)
Create a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
protected abstract NativeWebRequest |
getWebRequest()
Required for access to NativeWebRequest in
supportsParameter(org.springframework.core.MethodParameter). |
Object |
resolveArgument(MethodParameter parameter,
ModelAndViewContainer mavContainer,
NativeWebRequest webRequest,
WebDataBinderFactory binderFactory)
Delegate to the
WebArgumentResolver instance. |
boolean |
supportsParameter(MethodParameter parameter)
Actually resolve the value and check the resolved value is not
WebArgumentResolver.UNRESOLVED absorbing _any_ exceptions. |
public AbstractWebArgumentResolverAdapter(WebArgumentResolver adaptee)
public boolean supportsParameter(MethodParameter parameter)
WebArgumentResolver.UNRESOLVED absorbing _any_ exceptions.supportsParameter in interface HandlerMethodArgumentResolverparameter - the method parameter to checktrue if this resolver supports the supplied parameter;
false otherwisepublic Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer, NativeWebRequest webRequest, WebDataBinderFactory binderFactory) throws Exception
WebArgumentResolver instance.resolveArgument in interface HandlerMethodArgumentResolverparameter - the method parameter to resolve. This parameter must
have previously been passed to HandlerMethodArgumentResolver.supportsParameter(org.springframework.core.MethodParameter) which must
have returned true.mavContainer - the ModelAndViewContainer for the current requestwebRequest - the current requestbinderFactory - a factory for creating WebDataBinder instancesnullIllegalStateException - if the resolved value is not assignable
to the method parameter.Exception - in case of errors with the preparation of argument valuesprotected abstract NativeWebRequest getWebRequest()
supportsParameter(org.springframework.core.MethodParameter).