Spring Framework

org.springframework.web.method.support
Class HandlerMethodArgumentResolverComposite

java.lang.Object
  extended by org.springframework.web.method.support.HandlerMethodArgumentResolverComposite
All Implemented Interfaces:
HandlerMethodArgumentResolver

public class HandlerMethodArgumentResolverComposite
extends java.lang.Object
implements HandlerMethodArgumentResolver

Resolves method parameters by delegating to a list of registered HandlerMethodArgumentResolvers. Previously resolved method parameters are cached for faster lookups.

Since:
3.1
Author:
Rossen Stoyanchev

Field Summary
protected  org.apache.commons.logging.Log logger
           
 
Constructor Summary
HandlerMethodArgumentResolverComposite()
           
 
Method Summary
 HandlerMethodArgumentResolverComposite addResolver(HandlerMethodArgumentResolver argumentResolver)
          Add the given HandlerMethodArgumentResolver.
 HandlerMethodArgumentResolverComposite addResolvers(java.util.List<? extends HandlerMethodArgumentResolver> argumentResolvers)
          Add the given HandlerMethodArgumentResolvers.
 java.util.List<HandlerMethodArgumentResolver> getResolvers()
          Return a read-only list with the contained resolvers, or an empty list.
 java.lang.Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer, NativeWebRequest webRequest, WebDataBinderFactory binderFactory)
          Iterate over registered HandlerMethodArgumentResolvers and invoke the one that supports it.
 boolean supportsParameter(MethodParameter parameter)
          Whether the given method parameter is supported by any registered HandlerMethodArgumentResolver.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected final org.apache.commons.logging.Log logger
Constructor Detail

HandlerMethodArgumentResolverComposite

public HandlerMethodArgumentResolverComposite()
Method Detail

getResolvers

public java.util.List<HandlerMethodArgumentResolver> getResolvers()
Return a read-only list with the contained resolvers, or an empty list.


supportsParameter

public boolean supportsParameter(MethodParameter parameter)
Whether the given method parameter is supported by any registered HandlerMethodArgumentResolver.

Specified by:
supportsParameter in interface HandlerMethodArgumentResolver
Parameters:
parameter - the method parameter to check
Returns:
true if this resolver supports the supplied parameter; false otherwise

resolveArgument

public java.lang.Object resolveArgument(MethodParameter parameter,
                                        ModelAndViewContainer mavContainer,
                                        NativeWebRequest webRequest,
                                        WebDataBinderFactory binderFactory)
                                 throws java.lang.Exception
Iterate over registered HandlerMethodArgumentResolvers and invoke the one that supports it.

Specified by:
resolveArgument in interface HandlerMethodArgumentResolver
Parameters:
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 request
webRequest - the current request
binderFactory - a factory for creating WebDataBinder instances
Returns:
the resolved argument value, or null.
Throws:
java.lang.IllegalStateException - if no suitable HandlerMethodArgumentResolver is found.
java.lang.Exception - in case of errors with the preparation of argument values

addResolver

public HandlerMethodArgumentResolverComposite addResolver(HandlerMethodArgumentResolver argumentResolver)
Add the given HandlerMethodArgumentResolver.


addResolvers

public HandlerMethodArgumentResolverComposite addResolvers(java.util.List<? extends HandlerMethodArgumentResolver> argumentResolvers)
Add the given HandlerMethodArgumentResolvers.


Spring Framework