|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.web.method.annotation.AbstractWebArgumentResolverAdapter
public abstract class AbstractWebArgumentResolverAdapter
An abstract base class adapting a 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 Summary | |
---|---|
AbstractWebArgumentResolverAdapter(WebArgumentResolver adaptee)
Create a new instance. |
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractWebArgumentResolverAdapter(WebArgumentResolver adaptee)
Method Detail |
---|
public boolean supportsParameter(MethodParameter parameter)
WebArgumentResolver.UNRESOLVED
absorbing _any_ exceptions.
supportsParameter
in interface HandlerMethodArgumentResolver
parameter
- the method parameter to check
true
if this resolver supports the supplied parameter;
false
otherwiseprotected abstract NativeWebRequest getWebRequest()
supportsParameter(org.springframework.core.MethodParameter)
.
public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer, NativeWebRequest webRequest, WebDataBinderFactory binderFactory) throws Exception
WebArgumentResolver
instance.
resolveArgument
in interface HandlerMethodArgumentResolver
parameter
- the method parameter to resolve. This parameter must
have previously been passed to
HandlerMethodArgumentResolver.supportsParameter(org.springframework.core.MethodParameter)
and it must have returned true
mavContainer
- the ModelAndViewContainer for the current requestwebRequest
- the current requestbinderFactory
- a factory for creating WebDataBinder
instances
null
.
IllegalStateException
- if the resolved value is not assignable
to the method parameter.
Exception
- in case of errors with the preparation of argument values
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |