Class ParserUtils


  • public class ParserUtils
    extends Object
    • Constructor Detail

      • ParserUtils

        public ParserUtils()
    • Method Detail

      • getTransformationFunction

        public static com.google.common.base.Function<String,​Object> getTransformationFunction​(String listDelimiter,
                                                                                                     com.google.common.base.Splitter listSplitter,
                                                                                                     boolean tryParseNumbers)
        Returns:
        a transformation function on an input value. The function performs the following transformations on the input string:
      • Splits it into multiple values using the listSplitter if the list delimiter is present in the input.
      • If tryParseNumbers is true, the function will also attempt to parse any numeric values present in the input: integers as Long and floating-point numbers as Double. If the input is not a number or parsing fails, the input is returned as-is as a string.
      • generateFieldNames

        public static ArrayList<String> generateFieldNames​(int length)
      • validateFields

        public static void validateFields​(Iterable<String> fieldNames)
      • stripQuotes

        public static String stripQuotes​(String input)
      • getDateTimeZone

        @Nullable
        public static org.joda.time.DateTimeZone getDateTimeZone​(String timeZone)
      • getDefaultColumnName

        public static String getDefaultColumnName​(int ordinal)
        Return a function to generate default column names. Note that the postfix for default column names starts from 1.
        Returns:
        column name generating function