Class QueryHintsHandler

java.lang.Object
cz.cvut.kbss.jopa.model.QueryHintsHandler

public class QueryHintsHandler extends Object
Processes query hints.

To add a new hint (inspired by Eclipselink):

  • Define a hint in QueryHints
  • Ad an inner class extending QueryHintsHandler.Hint corresponding to the new hint. The class should implement the QueryHintsHandler.Hint.applyToQuery(Object, AbstractQuery, Statement) method and provide an array of values for transformation.
  • Register the new hint class by calling QueryHintsHandler.Hint.registerHint(Hint) with an instance of the hint
  • Method Details

    • getSupportedHints

      public static Set<String> getSupportedHints()
      Gets query hints supported by this implementation.
      Returns:
      A set of query hint names
    • apply

      public static void apply(String hintName, Object hintValue, cz.cvut.kbss.jopa.model.AbstractQuery query, Statement statement)
      Applies the specified hint value to the specified query.

      Note that if the hint is unknown, it is ignored.

      Parameters:
      hintName - Query hint name
      hintValue - Query hint value
      query - Query to apply the hint value to
      statement - OntoDriver statement that will be used to execute the specified query. The hint value may be applied directly to it
      Throws:
      IllegalArgumentException - If the hint value is not supported