Package org.springframework.data.web
Class PageableHandlerMethodArgumentResolver
java.lang.Object
org.springframework.data.web.PageableHandlerMethodArgumentResolverSupport
org.springframework.data.web.PageableHandlerMethodArgumentResolver
- All Implemented Interfaces:
PageableArgumentResolver
,HandlerMethodArgumentResolver
- Direct Known Subclasses:
HateoasPageableHandlerMethodArgumentResolver
public class PageableHandlerMethodArgumentResolver
extends PageableHandlerMethodArgumentResolverSupport
implements PageableArgumentResolver
Extracts paging information from web requests and thus allows injecting
Pageable
instances into controller
methods. Request properties to be parsed can be configured defaulting to page
for the page number and
size
for the page size.
Parameters can be prefixed
to disambiguate from other parameters in the request if
necessary.
- Since:
- 1.6
- Author:
- Oliver Gierke, Nick Williams, Mark Paluch, Christoph Strobl, Yanming Zhou
-
Constructor Summary
ConstructorDescriptionConstructs an instance of this resolved with a defaultSortHandlerMethodArgumentResolver
.PageableHandlerMethodArgumentResolver
(SortArgumentResolver sortResolver) Constructs an instance of this resolver with the specifiedSortArgumentResolver
.Constructs an instance of this resolver with the specifiedSortHandlerMethodArgumentResolver
. -
Method Summary
Modifier and TypeMethodDescriptionresolveArgument
(MethodParameter methodParameter, ModelAndViewContainer mavContainer, NativeWebRequest webRequest, WebDataBinderFactory binderFactory) Resolves aPageable
method parameter into an argument value from a given request.boolean
supportsParameter
(MethodParameter parameter) Methods inherited from class org.springframework.data.web.PageableHandlerMethodArgumentResolverSupport
getMaxPageSize, getPageable, getPageParameterName, getParameterNameToUse, getSizeParameterName, isFallbackPageable, isOneIndexedParameters, setFallbackPageable, setMaxPageSize, setOneIndexedParameters, setPageParameterName, setPrefix, setQualifierDelimiter, setSizeParameterName
-
Constructor Details
-
PageableHandlerMethodArgumentResolver
public PageableHandlerMethodArgumentResolver()Constructs an instance of this resolved with a defaultSortHandlerMethodArgumentResolver
. -
PageableHandlerMethodArgumentResolver
Constructs an instance of this resolver with the specifiedSortHandlerMethodArgumentResolver
.- Parameters:
sortResolver
- the sort resolver to use
-
PageableHandlerMethodArgumentResolver
Constructs an instance of this resolver with the specifiedSortArgumentResolver
.- Parameters:
sortResolver
- the sort resolver to use- Since:
- 1.13
-
-
Method Details
-
supportsParameter
- Specified by:
supportsParameter
in interfaceHandlerMethodArgumentResolver
-
resolveArgument
public Pageable resolveArgument(MethodParameter methodParameter, @Nullable ModelAndViewContainer mavContainer, NativeWebRequest webRequest, @Nullable WebDataBinderFactory binderFactory) Description copied from interface:PageableArgumentResolver
Resolves aPageable
method parameter into an argument value from a given request.- Specified by:
resolveArgument
in interfaceHandlerMethodArgumentResolver
- Specified by:
resolveArgument
in interfacePageableArgumentResolver
- Parameters:
methodParameter
- the method parameter to resolve. This parameter must have previously been passed toHandlerMethodArgumentResolver.supportsParameter(org.springframework.core.MethodParameter)
which must have returnedtrue
.mavContainer
- the ModelAndViewContainer for the current requestwebRequest
- the current requestbinderFactory
- a factory for creatingWebDataBinder
instances- Returns:
- the resolved argument value.
-