public interface WebArgumentResolver
A typical implementation could look like as follows:
public class MySpecialArgumentResolver implements WebArgumentResolver { public Object resolveArgument(MethodParameter methodParameter, NativeWebRequest webRequest) { if (methodParameter.getParameterType().equals(MySpecialArg.class)) { return new MySpecialArg("myValue"); } return UNRESOLVED; } }
Modifier and Type | Field and Description |
---|---|
static java.lang.Object |
UNRESOLVED
Marker to be returned when the resolver does not know how to
handle the given method parameter.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
resolveArgument(MethodParameter methodParameter,
NativeWebRequest webRequest)
Resolve an argument for the given handler method parameter within the given web request.
|
static final java.lang.Object UNRESOLVED
java.lang.Object resolveArgument(MethodParameter methodParameter, NativeWebRequest webRequest) throws java.lang.Exception
methodParameter
- the handler method parameter to resolvewebRequest
- the current web request, allowing access to the native request as wellUNRESOLVED
if not resolvablejava.lang.Exception
- in case of resolution failure