Class EscapeQuerySyntaxImpl

    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static UnescapedCharSequence discardEscapeChar​(java.lang.CharSequence input)
      Returns a String where the escape char has been removed, or kept only once if there was a double escape.
      java.lang.CharSequence escape​(java.lang.CharSequence text, java.util.Locale locale, EscapeQuerySyntax.Type type)  
      private static java.lang.CharSequence escapeChar​(java.lang.CharSequence str, java.util.Locale locale)  
      private java.lang.CharSequence escapeQuoted​(java.lang.CharSequence str, java.util.Locale locale)  
      private static java.lang.CharSequence escapeTerm​(java.lang.CharSequence term, java.util.Locale locale)  
      private static java.lang.CharSequence escapeWhiteChar​(java.lang.CharSequence str, java.util.Locale locale)
      escape all tokens that are part of the parser syntax on a given string
      private static int hexToInt​(char c)
      Returns the numeric value of the hexadecimal character
      private static java.lang.CharSequence replaceIgnoreCase​(java.lang.CharSequence string, java.lang.CharSequence sequence1, java.lang.CharSequence escapeChar, java.util.Locale locale)
      replace with ignore case
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • wildcardChars

        private static final char[] wildcardChars
      • escapableTermExtraFirstChars

        private static final java.lang.String[] escapableTermExtraFirstChars
      • escapableTermChars

        private static final java.lang.String[] escapableTermChars
      • escapableQuotedChars

        private static final java.lang.String[] escapableQuotedChars
      • escapableWhiteChars

        private static final java.lang.String[] escapableWhiteChars
      • escapableWordTokens

        private static final java.lang.String[] escapableWordTokens
    • Constructor Detail

      • EscapeQuerySyntaxImpl

        public EscapeQuerySyntaxImpl()
    • Method Detail

      • escapeChar

        private static final java.lang.CharSequence escapeChar​(java.lang.CharSequence str,
                                                               java.util.Locale locale)
      • escapeQuoted

        private final java.lang.CharSequence escapeQuoted​(java.lang.CharSequence str,
                                                          java.util.Locale locale)
      • escapeTerm

        private static final java.lang.CharSequence escapeTerm​(java.lang.CharSequence term,
                                                               java.util.Locale locale)
      • replaceIgnoreCase

        private static java.lang.CharSequence replaceIgnoreCase​(java.lang.CharSequence string,
                                                                java.lang.CharSequence sequence1,
                                                                java.lang.CharSequence escapeChar,
                                                                java.util.Locale locale)
        replace with ignore case
        Parameters:
        string - string to get replaced
        sequence1 - the old character sequence in lowercase
        escapeChar - the new character to prefix sequence1 in return string.
        Returns:
        the new String
      • escapeWhiteChar

        private static final java.lang.CharSequence escapeWhiteChar​(java.lang.CharSequence str,
                                                                    java.util.Locale locale)
        escape all tokens that are part of the parser syntax on a given string
        Parameters:
        str - string to get replaced
        locale - locale to be used when performing string compares
        Returns:
        the new String
      • escape

        public java.lang.CharSequence escape​(java.lang.CharSequence text,
                                             java.util.Locale locale,
                                             EscapeQuerySyntax.Type type)
        Specified by:
        escape in interface EscapeQuerySyntax
        Parameters:
        text - - text to be escaped
        locale - - locale for the current query
        type - - select the type of escape operation to use
        Returns:
        escaped text
      • discardEscapeChar

        public static UnescapedCharSequence discardEscapeChar​(java.lang.CharSequence input)
                                                       throws ParseException
        Returns a String where the escape char has been removed, or kept only once if there was a double escape.

        Supports escaped unicode characters, e. g. translates A to A.

        Throws:
        ParseException
      • hexToInt

        private static final int hexToInt​(char c)
                                   throws ParseException
        Returns the numeric value of the hexadecimal character
        Throws:
        ParseException