Class AbstractWebQueryPageableArgumentResolver

java.lang.Object
in.co.akshitbansal.springwebquery.resolver.spring.AbstractWebQueryResolver
in.co.akshitbansal.springwebquery.resolver.spring.AbstractWebQueryPageableArgumentResolver
All Implemented Interfaces:
org.springframework.web.method.support.HandlerMethodArgumentResolver
Direct Known Subclasses:
WebQueryDTOAwarePageableArgumentResolver, WebQueryEntityAwarePageableArgumentResolver

public abstract class AbstractWebQueryPageableArgumentResolver extends AbstractWebQueryResolver
Base resolver for Pageable parameters participating in WebQuery-aware sorting.

This class delegates standard page/size parsing to Spring's PageableHandlerMethodArgumentResolver and lets subclasses validate and remap sort properties against either entity or DTO metadata.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final org.springframework.data.web.PageableHandlerMethodArgumentResolver
    Delegate used to parse raw pageable parameters from the request.
    protected final FieldResolverFactory
    Factory used to create entity-aware or DTO-aware field resolvers for sort paths.
    protected final SortableFieldValidator
    Validator used to enforce @Sortable constraints on resolved sort fields.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    getQueryConfiguration(org.springframework.core.MethodParameter parameter)
    Extracts pageable-specific query metadata directly from the WebQuery annotation declared on the supplied controller method.
    org.springframework.data.domain.Pageable
    resolveArgument(org.springframework.core.MethodParameter parameter, @Nullable org.springframework.web.method.support.ModelAndViewContainer mavContainer, org.springframework.web.context.request.NativeWebRequest webRequest, @Nullable org.springframework.web.bind.support.WebDataBinderFactory binderFactory)
    Resolves the request into a validated Pageable using Spring's standard parsing first and subclass-specific sort validation afterward.
    protected abstract org.springframework.data.domain.Pageable
    resolvePageable(org.springframework.data.domain.Pageable pageable, PageableArgumentResolverConfig queryConfig)
    Validates and remaps pageable sorting according to the effective query configuration.
    boolean
    supportsParameter(org.springframework.core.MethodParameter parameter)
    Determines whether the supplied parameter should be resolved as a Pageable participating in WebQuery-aware sorting.

    Methods inherited from class in.co.akshitbansal.springwebquery.resolver.spring.AbstractWebQueryResolver

    getWebQueryAnnotation

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • delegate

      protected final org.springframework.data.web.PageableHandlerMethodArgumentResolver delegate
      Delegate used to parse raw pageable parameters from the request.
    • sortableFieldValidator

      protected final SortableFieldValidator sortableFieldValidator
      Validator used to enforce @Sortable constraints on resolved sort fields.
    • fieldResolverFactory

      protected final FieldResolverFactory fieldResolverFactory
      Factory used to create entity-aware or DTO-aware field resolvers for sort paths.
  • Constructor Details

    • AbstractWebQueryPageableArgumentResolver

      public AbstractWebQueryPageableArgumentResolver()
  • Method Details

    • supportsParameter

      public boolean supportsParameter(org.springframework.core.MethodParameter parameter)
      Determines whether the supplied parameter should be resolved as a Pageable participating in WebQuery-aware sorting.
      Specified by:
      supportsParameter in interface org.springframework.web.method.support.HandlerMethodArgumentResolver
      Overrides:
      supportsParameter in class AbstractWebQueryResolver
      Parameters:
      parameter - method parameter under inspection
      Returns:
      true when the parameter type is assignable to Pageable and the declaring method is annotated with WebQuery
    • resolveArgument

      public org.springframework.data.domain.Pageable resolveArgument(org.springframework.core.MethodParameter parameter, @Nullable org.springframework.web.method.support.ModelAndViewContainer mavContainer, org.springframework.web.context.request.NativeWebRequest webRequest, @Nullable org.springframework.web.bind.support.WebDataBinderFactory binderFactory)
      Resolves the request into a validated Pageable using Spring's standard parsing first and subclass-specific sort validation afterward.
      Parameters:
      parameter - method parameter being resolved
      mavContainer - current model/view container, if any
      webRequest - current native web request
      binderFactory - web data binder factory, if available
      Returns:
      validated pageable instance for the current request
      Throws:
      QueryException - when query-specific validation fails
      QueryConfigurationException - when pageable resolution fails unexpectedly
    • resolvePageable

      protected abstract org.springframework.data.domain.Pageable resolvePageable(org.springframework.data.domain.Pageable pageable, PageableArgumentResolverConfig queryConfig)
      Validates and remaps pageable sorting according to the effective query configuration.
      Parameters:
      pageable - pageable parsed from the request
      queryConfig - effective query configuration derived from WebQuery
      Returns:
      pageable with validated and possibly remapped sort orders
    • getQueryConfiguration

      protected PageableArgumentResolverConfig getQueryConfiguration(org.springframework.core.MethodParameter parameter)
      Extracts pageable-specific query metadata directly from the WebQuery annotation declared on the supplied controller method.

      Unlike specification resolution, pageable handling does not consume operator policies or AST settings, so this configuration contains only the entity type, optional DTO type, and the declared field mappings retained for entity-aware sort validation and remapping.

      Parameters:
      parameter - supported method parameter whose declaring method carries WebQuery
      Returns:
      effective configuration used by pageable resolvers for sort validation