Class WebQueryEntityAwareSpecificationArgumentResolver
java.lang.Object
in.co.akshitbansal.springwebquery.resolver.WebQuerySpecificationArgumentResolver
in.co.akshitbansal.springwebquery.resolver.WebQueryEntityAwareSpecificationArgumentResolver
- All Implemented Interfaces:
org.springframework.web.method.support.HandlerMethodArgumentResolver
public class WebQueryEntityAwareSpecificationArgumentResolver
extends WebQuerySpecificationArgumentResolver
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.WebQuerySpecificationArgumentResolver
WebQuerySpecificationArgumentResolver.QueryConfiguration -
Field Summary
Fields inherited from class in.co.akshitbansal.springwebquery.resolver.WebQuerySpecificationArgumentResolver
annotationUtil, customPredicates, globalAllowAndOperator, globalAllowOrOperator, globalMaxASTDepth, rsqlParser -
Constructor Summary
ConstructorsConstructorDescriptionWebQueryEntityAwareSpecificationArgumentResolver(Set<RSQLDefaultOperator> defaultOperators, Set<? extends RSQLCustomOperator<?>> customOperators, AnnotationUtil annotationUtil, boolean globalAllowAndOperator, boolean globalAllowOrOperator, int globalMaxASTDepth) Creates an entity-aware RSQL specification resolver. -
Method Summary
Modifier and TypeMethodDescription@Nullable ObjectresolveArgument(@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 aSpecificationfrom the configured RSQL request parameter.booleansupportsParameter(org.springframework.core.MethodParameter parameter) Determines whether this resolver should handle the given parameter.Methods inherited from class in.co.akshitbansal.springwebquery.resolver.WebQuerySpecificationArgumentResolver
getQueryConfiguration
-
Constructor Details
-
WebQueryEntityAwareSpecificationArgumentResolver
public WebQueryEntityAwareSpecificationArgumentResolver(Set<RSQLDefaultOperator> defaultOperators, Set<? extends RSQLCustomOperator<?>> customOperators, AnnotationUtil annotationUtil, boolean globalAllowAndOperator, boolean globalAllowOrOperator, int globalMaxASTDepth) Creates an entity-aware RSQL specification resolver.- Parameters:
defaultOperators- built-in operators accepted in RSQL expressionscustomOperators- custom operators supported by parser and predicatesannotationUtil- utility for resolving annotations and configuration checksglobalAllowAndOperator- 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 behavior
-
-
Method Details
-
supportsParameter
public boolean supportsParameter(org.springframework.core.MethodParameter parameter) Determines whether this resolver should handle the given parameter.- Parameters:
parameter- method parameter under inspection- Returns:
truewhen parameter is aSpecificationwith method-levelWebQueryand no DTO class is configured
-
resolveArgument
public @Nullable Object 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) throws Exception Resolves aSpecificationfrom the configured RSQL request parameter.- Parameters:
parameter- controller method parameter being resolvedmavContainer- current MVC containerwebRequest- current requestbinderFactory- binder factory- Returns:
- resolved specification, or
Specification.unrestricted()when no filter exists - Throws:
Exception- when resolution fails
-