Class EntityValidationRSQLVisitor
java.lang.Object
in.co.akshitbansal.springwebquery.ast.AbstractValidationRSQLVisitor
in.co.akshitbansal.springwebquery.ast.EntityValidationRSQLVisitor
- All Implemented Interfaces:
cz.jirutka.rsql.parser.ast.RSQLVisitor<Void,NodeMetadata>
RSQL AST visitor that validates selectors directly against an entity model.
This visitor resolves request selectors to entity fields, applies any
configured FieldMapping aliases, and ensures that the resolved
terminal field is filterable for the requested operator.
It is typically used by entity-aware specification resolvers before
converting a parsed RSQL tree into a Spring Data JPA
Specification.
- See Also:
-
Field Summary
Fields inherited from class in.co.akshitbansal.springwebquery.ast.AbstractValidationRSQLVisitor
fieldResolver, filterableFieldValidator -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedEntityValidationRSQLVisitor(FieldResolver fieldResolver, FilterableFieldValidator filterableFieldValidator, boolean andNodeAllowed, boolean orNodeAllowed, int maxDepth) Creates a new entity validation visitor with the specified configuration. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidvalidateComparisonNode(cz.jirutka.rsql.parser.ast.ComparisonNode node) Validates a comparison node against the entity class.Methods inherited from class in.co.akshitbansal.springwebquery.ast.AbstractValidationRSQLVisitor
validateNode, visit, visit, visit
-
Constructor Details
-
EntityValidationRSQLVisitor
protected EntityValidationRSQLVisitor(FieldResolver fieldResolver, FilterableFieldValidator filterableFieldValidator, boolean andNodeAllowed, boolean orNodeAllowed, int maxDepth) Creates a new entity validation visitor with the specified configuration.- Parameters:
fieldResolver- resolver that validates selectors against the effective entity contractfilterableFieldValidator- validator used to enforceRSQLFilterableconstraintsandNodeAllowed- whether logical AND operator is allowedorNodeAllowed- whether logical OR operator is allowedmaxDepth- maximum allowed depth for the RSQL AST
-
-
Method Details
-
validateComparisonNode
protected void validateComparisonNode(cz.jirutka.rsql.parser.ast.ComparisonNode node) Validates a comparison node against the entity class.- Specified by:
validateComparisonNodein classAbstractValidationRSQLVisitor- Parameters:
node- the comparison node to validate- Throws:
QueryValidationException- if the field is unknown, not allowed, or the operator is invalid for the resolved terminal fieldQueryConfigurationException- if the field mapping is misconfigured
-