Class AbstractWebQuerySpecificationArgumentResolver

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

public abstract class AbstractWebQuerySpecificationArgumentResolver extends AbstractWebQueryResolver
Base HandlerMethodArgumentResolver for resolving RSQL-based Specification parameters.

This class merges WebQuery annotation settings with global defaults, reads the raw RSQL filter from the effective request parameter, and delegates DTO-aware or entity-aware specification creation to subclasses.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final List<io.github.perplexhub.rsql.RSQLCustomPredicate<?>>
    Custom predicates adapted for rsql-jpa specification conversion.
    protected final cz.jirutka.rsql.parser.RSQLParser
    Parser configured with the allowed default and custom comparison operators.
    Factory used to create validation visitors matching the active query contract.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    getQueryConfiguration(org.springframework.core.MethodParameter parameter)
    Resolves the effective query configuration by combining method-level WebQuery settings with the configured global fallbacks.
    org.springframework.data.jpa.domain.Specification<?>
    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 incoming request into a validated Specification using the effective query configuration for the current controller method.
    protected abstract org.springframework.data.jpa.domain.Specification<?>
    Resolves a validated specification for the supplied raw filter value and effective query configuration.
    boolean
    supportsParameter(org.springframework.core.MethodParameter parameter)
    Determines whether the supplied parameter should be resolved as a Specification participating in WebQuery-driven filtering.

    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

    • rsqlParser

      protected final cz.jirutka.rsql.parser.RSQLParser rsqlParser
      Parser configured with the allowed default and custom comparison operators.
    • customPredicates

      protected final List<io.github.perplexhub.rsql.RSQLCustomPredicate<?>> customPredicates
      Custom predicates adapted for rsql-jpa specification conversion.
    • validationRSQLVisitorFactory

      protected final ValidationRSQLVisitorFactory validationRSQLVisitorFactory
      Factory used to create validation visitors matching the active query contract.
  • Constructor Details

    • AbstractWebQuerySpecificationArgumentResolver

      public AbstractWebQuerySpecificationArgumentResolver()
  • Method Details

    • supportsParameter

      public boolean supportsParameter(org.springframework.core.MethodParameter parameter)
      Determines whether the supplied parameter should be resolved as a Specification participating in WebQuery-driven filtering.
      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 Specification and the declaring method is annotated with WebQuery
    • resolveArgument

      public org.springframework.data.jpa.domain.Specification<?> 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 incoming request into a validated Specification using the effective query configuration for the current controller method.
      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:
      resolved specification for the current request, or Specification.unrestricted() when no filter is supplied
      Throws:
      QueryException - when query-specific validation fails
      QueryConfigurationException - when specification resolution fails unexpectedly
    • resolveSpecification

      protected abstract org.springframework.data.jpa.domain.Specification<?> resolveSpecification(SpecificationArgumentResolverConfig queryConfig, String filter)
      Resolves a validated specification for the supplied raw filter value and effective query configuration.
      Parameters:
      queryConfig - effective query configuration derived from WebQuery
      filter - raw RSQL filter expression from the request
      Returns:
      resolved specification
    • getQueryConfiguration

      protected SpecificationArgumentResolverConfig getQueryConfiguration(org.springframework.core.MethodParameter parameter)
      Resolves the effective query configuration by combining method-level WebQuery settings with the configured global fallbacks.

      A blank WebQuery.filterParamName() delegates to the resolver's configured global default filter parameter name. Non-blank annotation overrides are validated before they are used for request lookup.

      Parameters:
      parameter - supported method parameter whose declaring method carries WebQuery
      Returns:
      effective configuration used by specification resolvers for validation and parsing