Interface QueryMacroHandler

All Known Implementing Classes:
AbstractQueryMacroHandler, DateAfterMacroHandler, DateBeforeMacroHandler, DateEqualsMacroHandler, EnumQueryMacroHandler, TimeBetweenQueryMacroHandler, TimeTodayQueryMacroHandler

public interface QueryMacroHandler
Interface to be implemented by JPQL macro handlers.

The implementation must be a managed bean with "prototype" scope.

  • Method Details

    • expandMacro

      String expandMacro(String queryString)
      Replaces macro with real JPQL code. If macro is not found, the source query string is returned.
      Parameters:
      queryString - source query string
      Returns:
      query string with macros replaced
    • setQueryParams

      void setQueryParams(Map<String,Object> namedParameters)
      Sets parameters of the expanded query to the macro handler.
      Parameters:
      namedParameters - all named parameters of the expanded query
    • setExpandedParamTypes

      void setExpandedParamTypes(Map<String,Class> parameterTypes)
      Sets expanded parameter types of the expanded query to the macro handler.
      Parameters:
      parameterTypes - all expanded parameter types
    • getParams

      Map<String,Object> getParams()
      Returns:
      all named parameters of the expanded query augmented with the macro parameters
    • replaceQueryParams

      String replaceQueryParams(String queryString, Map<String,Object> params)
      Replaces param names in queryString with its values from the params parameter. If macro is not found, the source query string is returned.
      Returns:
      modified query string