Class AnnotationUtil

java.lang.Object
in.co.akshitbansal.springwebquery.util.AnnotationUtil

public class AnnotationUtil extends Object
Utility methods for validating query-related annotation metadata.

This utility validates FieldMapping declarations and resolves filterability/operator constraints from RsqlFilterable annotations, including composed annotations in this library's annotation package.

  • Constructor Details

    • AnnotationUtil

      public AnnotationUtil(Set<? extends RsqlCustomOperator<?>> customOperators)
      Creates an annotation utility backed by registered custom operator instances.
      Parameters:
      customOperators - custom operators available to annotation-driven validation
  • Method Details

    • validateFieldMappings

      public void validateFieldMappings(@NonNull @NonNull FieldMapping[] fieldMappings)
      Validates FieldMapping definitions declared in WebQuery.

      Validation rules:

      Parameters:
      fieldMappings - field mappings to validate
      Throws:
      QueryConfigurationException - if duplicate aliases or duplicate target fields are found
    • validateFilterableField

      public void validateFilterableField(@NonNull @NonNull Field field, cz.jirutka.rsql.parser.ast.ComparisonOperator operator, String fieldPath)
      Validates that a field is marked as filterable and that the requested operator is permitted by its RsqlFilterable declaration(s).
      Parameters:
      field - field being targeted by the request selector
      operator - comparison operator requested in the query
      fieldPath - original selector path from the request
      Throws:
      QueryFieldValidationException - if the field is not filterable
      QueryForbiddenOperatorException - if the operator is not allowed for the field