Class SpecStringParser

java.lang.Object
com.bazaarvoice.jolt.common.SpecStringParser

public class SpecStringParser extends Object
Static utility methods for handling specStrings such that we can process them into usable formats for further processing into PathElement objects
  • Constructor Details

    • SpecStringParser

      private SpecStringParser()
  • Method Details

    • parseDotNotation

      public static List<String> parseDotNotation(List<String> pathStrings, Iterator<Character> iter, String dotNotationRef)
      Method that recursively parses a dotNotation String based on an iterator. This method will call out to parseAtPathElement
      Parameters:
      pathStrings - List to store parsed Strings that each represent a PathElement
      iter - the iterator to pull characters from
      dotNotationRef - the original dotNotation string used for error messages
      Returns:
      evaluated List from dot notation string spec
    • stringIterator

      public static Iterator<Character> stringIterator(String string)
      Helper method to turn a String into an Iterator
    • fixLeadingBracketSugar

      public static String fixLeadingBracketSugar(String dotNotaton)
      Given a dotNotation style outputPath like "data[2].invalid input: '&'(1,1)", this method fixes the syntactic sugar of "data[2]" --> "data.[2]" This makes all the rest of the String processing easier once we know that we can always split on the '.' character.
      Parameters:
      dotNotaton - Output path dot notation
      Returns:
    • parseAtPathElement

      public static String parseAtPathElement(Iterator<Character> iter, String dotNotationRef)
      Parse RHS Transpose @ logic. "@(a.b)" --> pulls "(a.b)" off the iterator "@a.b" --> pulls just "a" off the iterator This method expects that the the '@' character has already been seen.
      Parameters:
      iter - iterator to pull data from
      dotNotationRef - the original dotNotation string used for error messages
    • removeEscapedValues

      public static String removeEscapedValues(String origKey)
    • removeEscapeChars

      public static String removeEscapeChars(String origKey)
    • parseFunctionArgs

      public static List<String> parseFunctionArgs(String argString)