Class HqlHumanUtil
- java.lang.Object
-
- org.hansken.plugin.extraction.hql_lite.lang.human.HqlHumanUtil
-
public final class HqlHumanUtil extends Object
HQL-human string utilities.- Author:
- Netherlands Forensic Institute
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classHqlHumanUtil.TermEscaperEscapes any non-letter or non-digit characters, except glue characters or characters that never need escaping.static classHqlHumanUtil.UnicodeCodepointUnescaperUnicode Codepoint Unescaper.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static 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 booleanisPlain(String text)Returns whether text contains only plain characters that need no escaping.static StringswapEscapedWildcards(String query)Swap the escaped wildcards with placeholders.static Stringunescape(String text)Unescapes 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 Detail
-
escapeText
public static String escapeText(String text)
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
public static String escapeTerm(String text)
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
public static String unescape(String text)
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
public static String unescapeKeepWildcards(String text)
Unescapes escaped characters, except wildcards, so it can be used within a term query.- Parameters:
text- the text to unescape- Returns:
- text
-
isPlain
public static boolean isPlain(String text)
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
public static String swapEscapedWildcards(String query)
Swap the escaped wildcards with placeholders.- Parameters:
query- the hql-lite query- Returns:
- the hql-lite query with placeholders instead of wildcards.
-
-