Class WebQueryDTOAwareSpecificationArgumentResolver
java.lang.Object
in.co.akshitbansal.springwebquery.resolver.spring.AbstractWebQueryResolver
in.co.akshitbansal.springwebquery.resolver.spring.AbstractWebQuerySpecificationArgumentResolver
in.co.akshitbansal.springwebquery.resolver.spring.WebQueryDTOAwareSpecificationArgumentResolver
- All Implemented Interfaces:
org.springframework.web.method.support.HandlerMethodArgumentResolver
public class WebQueryDTOAwareSpecificationArgumentResolver
extends AbstractWebQuerySpecificationArgumentResolver
DTO-based resolver for
Specification parameters handled via
method-level WebQuery.
This resolver is active when WebQuery.dtoClass() is configured.
Incoming RSQL selectors are validated against DTO fields and then translated
to entity paths before the specification is produced.
-
Field Summary
Fields inherited from class in.co.akshitbansal.springwebquery.resolver.spring.AbstractWebQuerySpecificationArgumentResolver
customPredicates, rsqlParser, validationRSQLVisitorFactory -
Constructor Summary
ConstructorsConstructorDescriptionWebQueryDTOAwareSpecificationArgumentResolver(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) Creates a DTO-aware RSQL specification resolver. -
Method Summary
Modifier and TypeMethodDescriptionprotected org.springframework.data.jpa.domain.Specification<?>resolveSpecification(SpecificationArgumentResolverConfig queryConfig, String filter) Parses, validates, and converts a DTO-oriented RSQL filter into a JPASpecification.booleansupportsParameter(org.springframework.core.MethodParameter parameter) Determines whether this resolver should handle the given parameter.Methods inherited from class in.co.akshitbansal.springwebquery.resolver.spring.AbstractWebQuerySpecificationArgumentResolver
getQueryConfiguration, resolveArgumentMethods inherited from class in.co.akshitbansal.springwebquery.resolver.spring.AbstractWebQueryResolver
getWebQueryAnnotation
-
Constructor Details
-
WebQueryDTOAwareSpecificationArgumentResolver
public WebQueryDTOAwareSpecificationArgumentResolver(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) Creates a DTO-aware RSQL specification resolver.- Parameters:
globalFilterParamName- global default request parameter name used whenWebQuery.filterParamName()is blankglobalAllowAndOperator- whether AND nodes are allowed by default when@WebQuerydoes not override that behaviorglobalAllowOrOperator- whether OR nodes are allowed by default when@WebQuerydoes not override that behaviorglobalMaxASTDepth- maximum AST depth allowed by default when@WebQuerydoes not override that behaviorrsqlParser- parser configured with the allowed comparison operatorscustomPredicates- custom predicates contributed to specification generationqueryParamNameValidator- validator used for filter parameter name overridesvalidationRSQLVisitorFactory- factory used to create DTO-aware validation visitors
-
-
Method Details
-
supportsParameter
public boolean supportsParameter(org.springframework.core.MethodParameter parameter) Determines whether this resolver should handle the given parameter.- Specified by:
supportsParameterin interfaceorg.springframework.web.method.support.HandlerMethodArgumentResolver- Overrides:
supportsParameterin classAbstractWebQuerySpecificationArgumentResolver- Parameters:
parameter- method parameter under inspection- Returns:
truewhen parameter is aSpecificationwith method-levelWebQueryand a configured DTO class
-
resolveSpecification
protected org.springframework.data.jpa.domain.Specification<?> resolveSpecification(SpecificationArgumentResolverConfig queryConfig, String filter) Parses, validates, and converts a DTO-oriented RSQL filter into a JPASpecification.- Specified by:
resolveSpecificationin classAbstractWebQuerySpecificationArgumentResolver- Parameters:
queryConfig- effective query configuration for the current requestfilter- raw RSQL filter string from the request- Returns:
- resolved specification for the validated filter
-