java.lang.Object
org.evomaster.client.java.controller.mongo.selectors.QuerySelector
Direct Known Subclasses:
AllSelector, BitsAllClearSelector, BitsAllSetSelector, BitsAnyClearSelector, BitsAnySetSelector, ElemMatchSelector, EqualsSelector, ExistsSelector, GreaterThanEqualsSelector, GreaterThanSelector, ImplicitSelector, InSelector, LessThanEqualsSelector, LessThanSelector, ModSelector, MultiConditionQuerySelector, NearSphereSelector, NotEqualsSelector, NotInSelector, NotSelector, RegexSelector, SizeSelector, TypeSelector

public abstract class QuerySelector extends Object
A selector is used to determine if a query correspond to a certain operation. To do so it checks that the syntax is correct (operator, value type, etc.). Each selector maps to a unique operation.
  • Constructor Details

    • QuerySelector

      public QuerySelector()
  • Method Details

    • getOperation

      public abstract QueryOperation getOperation(Object query)
      Returns the operation mapped to the selector if the query satisfy all syntax checks or null if not.
    • isUniqueEntry

      protected Boolean isUniqueEntry(Map<?,?> map)
      Determines if the given map contains exactly one entry.
      Parameters:
      map - the map to be checked for uniqueness of entries; must not be null
      Returns:
      true if the map contains exactly one entry; false otherwise
    • hasTheExpectedOperator

      protected Boolean hasTheExpectedOperator(Object query)
      Determines if the given query has the expected operator associated with the selector.
      Parameters:
      query - the query object whose operator needs to be checked; must not be null
      Returns:
      true if the query contains the expected operator; false otherwise
    • extractOperator

      protected abstract String extractOperator(Object query)
      Extracts the operator (for example $eq) from the query.
    • operator

      protected abstract String operator()
      The operator a query must have to be considered as an instance of the corresponding operation.