Class HqlHumanUtil


  • public final class HqlHumanUtil
    extends Object
    HQL-human string utilities.
    Author:
    Netherlands Forensic Institute
    • 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.