Class WebQueryEntityAwareSpecificationArgumentResolver
java.lang.Object
in.co.akshitbansal.springwebquery.resolver.spring.AbstractWebQueryResolver
in.co.akshitbansal.springwebquery.resolver.spring.AbstractWebQuerySpecificationArgumentResolver
in.co.akshitbansal.springwebquery.resolver.spring.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.
-
Nested Class Summary
Nested classes/interfaces inherited from class in.co.akshitbansal.springwebquery.resolver.spring.AbstractWebQuerySpecificationArgumentResolver
AbstractWebQuerySpecificationArgumentResolver.QueryConfiguration -
Field Summary
Fields inherited from class in.co.akshitbansal.springwebquery.resolver.spring.AbstractWebQuerySpecificationArgumentResolver
customOperators, customPredicates, rsqlParser -
Constructor Summary
ConstructorsConstructorDescriptionWebQueryEntityAwareSpecificationArgumentResolver(String globalFilterParamName, boolean globalAllowAndOperator, boolean globalAllowOrOperator, int globalMaxASTDepth, Set<RSQLDefaultOperator> defaultOperators, Set<? extends RSQLCustomOperator<?>> customOperators) Creates an entity-aware RSQL specification resolver. -
Method Summary
Modifier and TypeMethodDescriptionprotected org.springframework.data.jpa.domain.Specification<?>resolveSpecification(@NonNull AbstractWebQuerySpecificationArgumentResolver.QueryConfiguration queryConfig, @NonNull String filter) Parses, validates, and converts an entity-oriented RSQL filter into a JPASpecification.booleansupportsParameter(@NonNull 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
-
WebQueryEntityAwareSpecificationArgumentResolver
public WebQueryEntityAwareSpecificationArgumentResolver(String globalFilterParamName, boolean globalAllowAndOperator, boolean globalAllowOrOperator, int globalMaxASTDepth, Set<RSQLDefaultOperator> defaultOperators, Set<? extends RSQLCustomOperator<?>> customOperators) Creates an entity-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 behaviordefaultOperators- built-in operators accepted in RSQL expressionscustomOperators- custom operators supported by parser and predicates
-
-
Method Details
-
supportsParameter
public boolean supportsParameter(@NonNull @NonNull 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 no DTO class is configured
-
resolveSpecification
protected org.springframework.data.jpa.domain.Specification<?> resolveSpecification(@NonNull @NonNull AbstractWebQuerySpecificationArgumentResolver.QueryConfiguration queryConfig, @NonNull @NonNull String filter) Parses, validates, and converts an entity-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
-