|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface WebArgumentResolver
SPI for resolving custom arguments for a specific handler method parameter. Typically implemented to detect special parameter types, resolving well-known argument values for them.
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; } }
AnnotationMethodHandlerAdapter.setCustomArgumentResolvers(org.springframework.web.bind.support.WebArgumentResolver[])
,
AnnotationMethodHandlerAdapter.setCustomArgumentResolvers(org.springframework.web.bind.support.WebArgumentResolver[])
Field Summary | |
---|---|
static Object |
UNRESOLVED
Marker to be returned when the resolver does not know how to handle the given method parameter. |
Method Summary | |
---|---|
Object |
resolveArgument(MethodParameter methodParameter,
NativeWebRequest webRequest)
Resolve an argument for the given handler method parameter within the given web request. |
Field Detail |
---|
static final Object UNRESOLVED
Method Detail |
---|
Object resolveArgument(MethodParameter methodParameter, NativeWebRequest webRequest) throws Exception
methodParameter
- the handler method parameter to resolvewebRequest
- the current web request, allowing access to the native request as well
UNRESOLVED
if not resolvable
Exception
- in case of resolution failure
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |