Class HqlHumanUtil
java.lang.Object
org.hansken.plugin.extraction.hql_lite.lang.human.HqlHumanUtil
HQL-human string utilities.
- Author:
- Netherlands Forensic Institute
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classEscapes any non-letter or non-digit characters, except glue characters or characters that never need escaping.static classUnicode Codepoint Unescaper. -
Method Summary
Modifier and TypeMethodDescriptionstatic StringescapeTerm(String text) Escapes text so it can be used as a term.static StringescapeText(String text) Escapes full, untokenized text so it can be used within a single quoted string literal.static booleanReturns whether text contains only plain characters that need no escaping.static StringswapEscapedWildcards(String query) Swap the escaped wildcards with placeholders.static StringUnescapes escaped characters, including wildcards, so it can be used within a query or for suggestions.static StringunescapeKeepWildcards(String text) Unescapes escaped characters, except wildcards, so it can be used within a term query.static StringunswapEscapedWildcards(String query) Restore placeholders with their respective escaped wildcards.
-
Method Details
-
escapeText
Escapes full, untokenized text so it can be used within a single quoted string literal. Escapes: - backslashes - single quotes - whitespace- Parameters:
text- the text to escape- Returns:
- text
-
escapeTerm
Escapes text so it can be used as a term. Escapes: - backslashes - single quotes - whitespace - any non-alphanumertic characters that are not glue characters.- Parameters:
text- the text to escape- Returns:
- text
-
unescape
Unescapes escaped characters, including wildcards, so it can be used within a query or for suggestions.- Parameters:
text- the text to unescape- Returns:
- text
-
unescapeKeepWildcards
Unescapes escaped characters, except wildcards, so it can be used within a term query.- Parameters:
text- the text to unescape- Returns:
- text
-
isPlain
Returns whether text contains only plain characters that need no escaping.- Parameters:
text- the text to test- Returns:
- whether text contains only plain characters that need no escaping.
-
swapEscapedWildcards
Swap the escaped wildcards with placeholders.- Parameters:
query- the hql-lite query- Returns:
- the hql-lite query with placeholders instead of wildcards.
-
unswapEscapedWildcards
Restore placeholders with their respective escaped wildcards.- Parameters:
query- the hql-lite query with placeholders- Returns:
- the hql-lite query with wildcards instead of placeholders.
-