Class AbstractWebQuerySpecificationArgumentResolver
- All Implemented Interfaces:
org.springframework.web.method.support.HandlerMethodArgumentResolver
- Direct Known Subclasses:
WebQueryDTOAwareSpecificationArgumentResolver,WebQueryEntityAwareSpecificationArgumentResolver
HandlerMethodArgumentResolver for resolving RSQL-based
Specification parameters.
This class initializes a parser constrained to the configured default and
custom operators, adapts custom operators into RSQLCustomPredicate
instances accepted by the underlying rsql-jpa integration, and
merges WebQuery annotation settings with global defaults before
delegating DTO-aware or entity-aware specification creation to subclasses.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classEffective specification-specific query metadata derived from a supportedWebQuery-annotated controller method after global defaults have been applied. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Map<Class<?>,RSQLCustomOperator<?>> Registered custom operators keyed by implementation class for downstream validation visitors.protected final List<io.github.perplexhub.rsql.RSQLCustomPredicate<?>>Custom predicates adapted forrsql-jpaspecification conversion.protected final cz.jirutka.rsql.parser.RSQLParserParser configured with the allowed default and custom comparison operators. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractWebQuerySpecificationArgumentResolver(String globalFilterParamName, boolean globalAllowAndOperator, boolean globalAllowOrOperator, int globalMaxASTDepth, Set<RSQLDefaultOperator> defaultOperators, Set<? extends RSQLCustomOperator<?>> customOperators) Creates the resolver base with global validation defaults, parser configuration, and custom predicate adaptation. -
Method Summary
Modifier and TypeMethodDescriptiongetQueryConfiguration(@NonNull org.springframework.core.MethodParameter parameter) Resolves the effective query configuration by combining method-levelWebQuerysettings with the configured global fallbacks.org.springframework.data.jpa.domain.Specification<?>resolveArgument(@NonNull org.springframework.core.MethodParameter parameter, org.springframework.web.method.support.ModelAndViewContainer mavContainer, @NonNull org.springframework.web.context.request.NativeWebRequest webRequest, org.springframework.web.bind.support.WebDataBinderFactory binderFactory) protected abstract org.springframework.data.jpa.domain.Specification<?>resolveSpecification(@NonNull AbstractWebQuerySpecificationArgumentResolver.QueryConfiguration queryConfig, @NonNull String filter) Resolves a validated specification for the supplied raw filter value and effective query configuration.booleansupportsParameter(@NonNull org.springframework.core.MethodParameter parameter) Determines whether the supplied method parameter belongs to a controller method annotated withWebQuery.Methods inherited from class in.co.akshitbansal.springwebquery.resolver.spring.AbstractWebQueryResolver
getWebQueryAnnotation
-
Field Details
-
rsqlParser
protected final cz.jirutka.rsql.parser.RSQLParser rsqlParserParser configured with the allowed default and custom comparison operators. -
customPredicates
Custom predicates adapted forrsql-jpaspecification conversion. -
customOperators
Registered custom operators keyed by implementation class for downstream validation visitors.
-
-
Constructor Details
-
AbstractWebQuerySpecificationArgumentResolver
protected AbstractWebQuerySpecificationArgumentResolver(String globalFilterParamName, boolean globalAllowAndOperator, boolean globalAllowOrOperator, int globalMaxASTDepth, Set<RSQLDefaultOperator> defaultOperators, Set<? extends RSQLCustomOperator<?>> customOperators) Creates the resolver base with global validation defaults, parser configuration, and custom predicate adaptation.- Parameters:
globalFilterParamName- global default request parameter name used whenWebQuery.filterParamName()is blankglobalAllowAndOperator- fallback AND-node policy used when@WebQuerydefers to global settingsglobalAllowOrOperator- fallback OR-node policy used when@WebQuerydefers to global settingsglobalMaxASTDepth- fallback maximum AST depth used when@WebQuerydefers to global settingsdefaultOperators- built-in operators accepted by the parsercustomOperators- custom operators to register for parsing and predicate generation
-
-
Method Details
-
supportsParameter
public boolean supportsParameter(@NonNull @NonNull org.springframework.core.MethodParameter parameter) Description copied from class:AbstractWebQueryResolverDetermines whether the supplied method parameter belongs to a controller method annotated withWebQuery.This base implementation uses
AbstractWebQueryResolver.getWebQueryAnnotation(MethodParameter)as the single source of truth for annotation lookup. Missing methods or missing annotations are treated as "not supported" rather than exceptional conditions so Spring MVC can continue evaluating other resolvers.- Specified by:
supportsParameterin interfaceorg.springframework.web.method.support.HandlerMethodArgumentResolver- Overrides:
supportsParameterin classAbstractWebQueryResolver- Parameters:
parameter- method parameter under inspection- Returns:
truewhen the declaring method hasWebQuery, otherwisefalse
-
resolveArgument
public org.springframework.data.jpa.domain.Specification<?> resolveArgument(@NonNull @NonNull org.springframework.core.MethodParameter parameter, org.springframework.web.method.support.ModelAndViewContainer mavContainer, @NonNull @NonNull org.springframework.web.context.request.NativeWebRequest webRequest, org.springframework.web.bind.support.WebDataBinderFactory binderFactory) -
resolveSpecification
protected abstract org.springframework.data.jpa.domain.Specification<?> resolveSpecification(@NonNull @NonNull AbstractWebQuerySpecificationArgumentResolver.QueryConfiguration queryConfig, @NonNull @NonNull String filter) Resolves a validated specification for the supplied raw filter value and effective query configuration.- Parameters:
queryConfig- effective query configuration derived fromWebQueryfilter- raw RSQL filter expression from the request- Returns:
- resolved specification
-
getQueryConfiguration
protected AbstractWebQuerySpecificationArgumentResolver.QueryConfiguration getQueryConfiguration(@NonNull @NonNull org.springframework.core.MethodParameter parameter) Resolves the effective query configuration by combining method-levelWebQuerysettings 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 carriesWebQuery- Returns:
- effective configuration used by specification resolvers for validation and parsing
-