Class SafeQuery.Translator

java.lang.Object
com.google.mu.safesql.SafeQuery.Translator
Enclosing class:
SafeQuery

public static class SafeQuery.Translator extends Object
An SPI class for subclasses to provide additional translation from placeholder values to safe query strings.
Since:
7.2
  • Constructor Details

    • Translator

      protected Translator()
  • Method Details

    • translate

      public final StringFormat.Template<SafeQuery> translate(@CompileTimeConstant String template)
      Translates template to a factory of SafeQuery by filling the provided parameters in the places of corresponding placeholders.
    • translateLiteral

      protected SafeQuery translateLiteral(Substring.Match placeholder, Object value)
      Called if a placeholder value is a non-string, non-Iterable literal appearing unquoted in the template.

      Subclasses should translate their trusted types and delegate to super.translateLiteral() for all other types.

      Parameters:
      placeholder - the placeholder in the template to be filled with value
      value - the literal value to fill in (not CharSequence or Character). Can be null.
      Returns:
      a sub-query to be filled into the result query in the place of placeholder
      Since:
      8.0