Class ParserUtils


  • public class ParserUtils
    extends Object
    This class contains a few methods for parser listeners
    • Constructor Detail

      • ParserUtils

        private ParserUtils()
    • Method Detail

      • stripeQuotes

        public static String stripeQuotes​(String text)
        stripes double quotes that surrounds a string
        Parameters:
        text - text
        Returns:
        text without surrounding double quotes
      • stripeAlias

        public static String stripeAlias​(String text,
                                         String alias)
        this method stripes table alias and dot give string
        Parameters:
        text - string with possible alias
        alias - table alias
        Returns:
        striped string
      • cloneOldToNewColumnValues

        public static void cloneOldToNewColumnValues​(Map<String,​LogMinerColumnValueWrapper> newColumnValues,
                                                     Map<String,​LogMinerColumnValueWrapper> oldColumnValues,
                                                     Table table)
        Initialize new column values with old column values. It does not override new values which were processed already in where clause parsing
        Parameters:
        newColumnValues - values to set or insert
        oldColumnValues - values in WHERE clause
        table - Debezium Table object
      • convertValueToSchemaType

        public static Object convertValueToSchemaType​(Column column,
                                                      Object value,
                                                      OracleValueConverters converters)
        This converts the given value to the appropriate object. The conversion is based on the column definition
        Parameters:
        column - column Object
        value - value object
        converters - given converter
        Returns:
        object as the result of this conversion. It could be null if converter cannot build the schema or if converter or value are null
      • removeApostrophes

        public static String removeApostrophes​(String text)
        In some cases values of the parsed expression are enclosed in apostrophes. Even null values are surrounded by single apostrophes. This method removes them.
        Parameters:
        text - supplied value which might be enclosed by apostrophes.
        Returns:
        clean String or null in case if test = "null" or = "NULL"
      • replaceDoubleBackSlashes

        public static String replaceDoubleBackSlashes​(String text)
        this is to handle cases when a record contains escape character(s)
        Parameters:
        text - before parsing we replaced it with double escape, now revert it back
        Returns:
        string with double slashes