Package com.google.mu.safesql
Class SafeQuery.Translator
java.lang.Object
com.google.mu.safesql.SafeQuery.Translator
- Enclosing class:
SafeQuery
An SPI class for subclasses to provide additional translation from
placeholder values to safe query strings.
- Since:
- 7.2
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal StringFormat.Template
<SafeQuery> Translatestemplate
to a factory ofSafeQuery
by filling the provided parameters in the places of corresponding placeholders.protected SafeQuery
translateLiteral
(Substring.Match placeholder, Object value) Called if a placeholdervalue
is a non-string, non-Iterable literal appearing unquoted in the template.
-
Constructor Details
-
Translator
protected Translator()
-
-
Method Details
-
translate
Translatestemplate
to a factory ofSafeQuery
by filling the provided parameters in the places of corresponding placeholders. -
translateLiteral
Called if a placeholdervalue
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 withvalue
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
-