Class WebQueryEntityAwareSpecificationArgumentResolver

All Implemented Interfaces:
org.springframework.web.method.support.HandlerMethodArgumentResolver

public class WebQueryEntityAwareSpecificationArgumentResolver extends AbstractWebQuerySpecificationArgumentResolver
Entity-based resolver for Specification parameters handled via method-level WebQuery.

This resolver is active when WebQuery.dtoClass() is not configured (i.e. equals void.class). It validates incoming RSQL selectors against entity fields and optional FieldMapping aliases before producing a JPA specification.

  • Constructor Details

    • WebQueryEntityAwareSpecificationArgumentResolver

      public WebQueryEntityAwareSpecificationArgumentResolver(String globalFilterParamName, boolean globalAllowAndOperator, boolean globalAllowOrOperator, int globalMaxASTDepth, cz.jirutka.rsql.parser.RSQLParser rsqlParser, List<io.github.perplexhub.rsql.RSQLCustomPredicate<?>> customPredicates, QueryParamNameValidator queryParamNameValidator, ValidationRSQLVisitorFactory validationRSQLVisitorFactory, FieldMappingsValidator fieldMappingsValidator)
      Creates an entity-aware RSQL specification resolver.
      Parameters:
      globalFilterParamName - global default request parameter name used when WebQuery.filterParamName() is blank
      globalAllowAndOperator - whether AND nodes are allowed by default when @WebQuery does not override that behavior
      globalAllowOrOperator - whether OR nodes are allowed by default when @WebQuery does not override that behavior
      globalMaxASTDepth - maximum AST depth allowed by default when @WebQuery does not override that behavior
      rsqlParser - parser configured with the allowed comparison operators
      customPredicates - custom predicates contributed to specification generation
      queryParamNameValidator - validator used for filter parameter name overrides
      validationRSQLVisitorFactory - factory used to create entity-aware validation visitors
      fieldMappingsValidator - validator used to check declared FieldMapping aliases
  • Method Details

    • supportsParameter

      public boolean supportsParameter(org.springframework.core.MethodParameter parameter)
      Determines whether this resolver should handle the given parameter.
      Specified by:
      supportsParameter in interface org.springframework.web.method.support.HandlerMethodArgumentResolver
      Overrides:
      supportsParameter in class AbstractWebQuerySpecificationArgumentResolver
      Parameters:
      parameter - method parameter under inspection
      Returns:
      true when parameter is a Specification with method-level WebQuery and no DTO class is configured
    • resolveSpecification

      protected org.springframework.data.jpa.domain.Specification<?> resolveSpecification(AbstractWebQuerySpecificationArgumentResolver.QueryConfiguration queryConfig, String filter)
      Parses, validates, and converts an entity-oriented RSQL filter into a JPA Specification.
      Specified by:
      resolveSpecification in class AbstractWebQuerySpecificationArgumentResolver
      Parameters:
      queryConfig - effective query configuration for the current request
      filter - raw RSQL filter string from the request
      Returns:
      resolved specification for the validated filter