Class WebQuerySpecificationArgumentResolver
java.lang.Object
in.co.akshitbansal.springwebquery.resolver.spring.AbstractWebQueryResolver
in.co.akshitbansal.springwebquery.resolver.spring.WebQuerySpecificationArgumentResolver
- All Implemented Interfaces:
org.springframework.web.method.support.HandlerMethodArgumentResolver
Unified
HandlerMethodArgumentResolver for resolving RSQL-based
Specification parameters.
This resolver merges WebQuery annotation settings with global
defaults, reads the raw RSQL filter from the effective request parameter,
validates the parsed AST, and builds the final specification directly for
either DTO-aware or entity-aware query contracts.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected SpecificationArgumentResolverConfiggetQueryConfiguration(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, @Nullable org.springframework.web.method.support.ModelAndViewContainer mavContainer, @NonNull org.springframework.web.context.request.NativeWebRequest webRequest, @Nullable org.springframework.web.bind.support.WebDataBinderFactory binderFactory) Resolves the incoming request into a validatedSpecificationusing the effective query configuration for the current controller method.booleansupportsParameter(@NonNull org.springframework.core.MethodParameter parameter) Determines whether the supplied parameter should be resolved as aSpecificationparticipating inWebQuery-driven filtering.Methods inherited from class in.co.akshitbansal.springwebquery.resolver.spring.AbstractWebQueryResolver
getWebQueryAnnotation
-
Constructor Details
-
WebQuerySpecificationArgumentResolver
public WebQuerySpecificationArgumentResolver()
-
-
Method Details
-
supportsParameter
public boolean supportsParameter(@NonNull @NonNull org.springframework.core.MethodParameter parameter) Determines whether the supplied parameter should be resolved as aSpecificationparticipating inWebQuery-driven filtering.- Specified by:
supportsParameterin interfaceorg.springframework.web.method.support.HandlerMethodArgumentResolver- Overrides:
supportsParameterin classAbstractWebQueryResolver- Parameters:
parameter- method parameter under inspection- Returns:
truewhen the parameter type is assignable toSpecificationand the declaring method is annotated withWebQuery
-
resolveArgument
public org.springframework.data.jpa.domain.Specification<?> resolveArgument(@NonNull @NonNull org.springframework.core.MethodParameter parameter, @Nullable org.springframework.web.method.support.ModelAndViewContainer mavContainer, @NonNull @NonNull org.springframework.web.context.request.NativeWebRequest webRequest, @Nullable org.springframework.web.bind.support.WebDataBinderFactory binderFactory) Resolves the incoming request into a validatedSpecificationusing the effective query configuration for the current controller method.- Parameters:
parameter- method parameter being resolvedmavContainer- current model/view container, if anywebRequest- current native web requestbinderFactory- 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 failsQueryConfigurationException- when specification resolution fails unexpectedly
-
getQueryConfiguration
protected SpecificationArgumentResolverConfig getQueryConfiguration(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. Declared field mappings are also validated eagerly so configuration errors are surfaced before request parsing begins.- Parameters:
parameter- supported method parameter whose declaring method carriesWebQuery- Returns:
- effective configuration used by specification resolvers for validation and parsing
-