Class AnnotationUtil

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

public class AnnotationUtil extends Object
Utility methods for resolving query-related annotations from controller metadata and validating FieldMapping declarations.
  • 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

    • resolveWebQueryFromParameter

      public WebQuery resolveWebQueryFromParameter(@NonNull @NonNull org.springframework.core.MethodParameter parameter)
      Resolves WebQuery from the controller method that declares the provided Spring MVC method parameter.
      Parameters:
      parameter - controller method parameter currently being resolved
      Returns:
      resolved WebQuery annotation
      Throws:
      QueryConfigurationException - if the method cannot be resolved or is not annotated with WebQuery
    • 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
    • getAllowedOperators

      public Set<cz.jirutka.rsql.parser.ast.ComparisonOperator> getAllowedOperators(@NonNull @NonNull RsqlFilterable filterable)
      Computes the full set of operators allowed for a field by combining built-in operators and registered custom operators referenced by RsqlFilterable.
      Parameters:
      filterable - field-level filterability metadata
      Returns:
      allowed comparison operators for the field
      Throws:
      QueryConfigurationException - if a referenced custom operator is not registered