Class DtoValidationRSQLVisitor
java.lang.Object
in.co.akshitbansal.springwebquery.DtoValidationRSQLVisitor
public class DtoValidationRSQLVisitor
extends Object
implements cz.jirutka.rsql.parser.ast.RSQLVisitor<Void,Void>
RSQL AST visitor that validates filters against a DTO contract and maps DTO
property paths to entity property paths.
This visitor is used when WebQuery.dtoClass()
is configured. It enforces that:
- The requested selector exists on the DTO type.
- The terminal DTO field is annotated with
RsqlFilterable. - The requested operator is allowed for that DTO field.
- The resulting mapped entity path can be resolved on the configured entity type.
During validation, selector mappings are captured and exposed via
getFieldMappings() so downstream query construction can apply
DTO-to-entity path translation.
-
Constructor Summary
ConstructorsConstructorDescriptionDtoValidationRSQLVisitor(Class<?> entityClass, Class<?> dtoClass, AnnotationUtil annotationUtil) Creates a DTO-aware validation visitor. -
Method Summary
Modifier and TypeMethodDescriptionReturns immutable selector mappings generated while visiting nodes.Visits a logical AND node and validates each child expression.Visits a comparison node and validates selector/operator compatibility.Visits a logical OR node and validates each child expression.
-
Constructor Details
-
DtoValidationRSQLVisitor
public DtoValidationRSQLVisitor(Class<?> entityClass, Class<?> dtoClass, AnnotationUtil annotationUtil) Creates a DTO-aware validation visitor.- Parameters:
entityClass- target entity type used for final path validationdtoClass- DTO type used to validate incoming selector pathsannotationUtil- helper for resolving allowed operators from annotations
-
-
Method Details
-
getFieldMappings
Returns immutable selector mappings generated while visiting nodes.- Returns:
- map from request DTO path to resolved entity path
-
visit
Visits a logical AND node and validates each child expression. -
visit
Visits a logical OR node and validates each child expression. -
visit
Visits a comparison node and validates selector/operator compatibility.
-