Class EntityValidationRSQLVisitor
java.lang.Object
in.co.akshitbansal.springwebquery.ast.ValidationRSQLVisitor
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.ValidationRSQLVisitor
filterableFieldValidator -
Constructor Summary
ConstructorsConstructorDescriptionEntityValidationRSQLVisitor(Class<?> entityClass, FieldMapping[] fieldMappings, Map<Class<?>, RSQLCustomOperator<?>> customOperators, 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.ValidationRSQLVisitor
validateNode, visit, visit, visit
-
Constructor Details
-
EntityValidationRSQLVisitor
public EntityValidationRSQLVisitor(Class<?> entityClass, FieldMapping[] fieldMappings, Map<Class<?>, RSQLCustomOperator<?>> customOperators, boolean andNodeAllowed, boolean orNodeAllowed, int maxDepth) Creates a new entity validation visitor with the specified configuration.- Parameters:
entityClass- the entity class to validate againstfieldMappings- array of field mappings (aliases) to considercustomOperators- registered custom operators keyed by implementation classandNodeAllowed- 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 classValidationRSQLVisitor- Parameters:
node- the comparison node to validate- Throws:
QueryValidationException- if the field is not allowed or operator is invalidQueryConfigurationException- if the field mapping is misconfigured
-