Class EntityQueryParser

java.lang.Object
com.foreach.across.modules.entity.query.EntityQueryParser

public class EntityQueryParser extends Object
Reverse parsing of a String into an EntityQuery. Uses a DefaultEntityQueryMetadataProvider if none is set.
Since:
2.0.0
Author:
Arne Vandamme
See Also:
  • Constructor Details

    • EntityQueryParser

      public EntityQueryParser()
  • Method Details

    • setMetadataProvider

      public void setMetadataProvider(@NonNull @NonNull EntityQueryMetadataProvider metadataProvider)
      Set the actual EntityQueryMetadataProvider that should be used for validating and typing query strings.
      Parameters:
      metadataProvider - instance
    • setQueryTranslator

      public void setQueryTranslator(@NonNull @NonNull EntityQueryTranslator queryTranslator)
      Set the DefaultEntityQueryTranslator to use for translating raw queries that passed validation.
      Parameters:
      queryTranslator - instance
    • validateProperties

      public void validateProperties()
    • parse

      public EntityQuery parse(String queryString)
      Convert a query string into a typed and validated EntityQuery. The setMetadataProvider(EntityQueryMetadataProvider) value will be used for validating the query, and - when passing validation - query will be translated by the EntityQueryTranslator.

      An exception will be thrown if the query cannot be converted.

      Parameters:
      queryString - string representation of the query
      Returns:
      query instance
      Throws:
      IllegalArgumentException - if parsing fails
    • prepare

      public EntityQuery prepare(EntityQuery rawQuery)
      Convert a raw EntityQuery instance into a validated and executable query instance that can be passed to the EntityQueryExecutor of the corresponding entity.

      Query translation will be done by the configured EntityQueryTranslator?

      Parameters:
      rawQuery - to convert
      Returns:
      executable query instance
    • parseRawQuery

      public static EntityQuery parseRawQuery(String eql)
      Parse an EQL statement into a raw EntityQuery. Exceptions will be thrown in case parsing fails.
      Parameters:
      eql - query
      Returns:
      query