Package com.bazaarvoice.jolt.common
Class SpecStringParser
- java.lang.Object
-
- com.bazaarvoice.jolt.common.SpecStringParser
-
public class SpecStringParser extends java.lang.Object
Static utility methods for handling specStrings such that we can process them into usable formats for further processing into PathElement objects
-
-
Constructor Summary
Constructors Modifier Constructor Description private
SpecStringParser()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
fixLeadingBracketSugar(java.lang.String dotNotaton)
Given a dotNotation style outputPath like "data[2].&(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.static java.lang.String
parseAtPathElement(java.util.Iterator<java.lang.Character> iter, java.lang.String dotNotationRef)
Parse RHS Transpose @ logic.static java.util.List<java.lang.String>
parseDotNotation(java.util.List<java.lang.String> pathStrings, java.util.Iterator<java.lang.Character> iter, java.lang.String dotNotationRef)
Method that recursively parses a dotNotation String based on an iterator.static java.util.List<java.lang.String>
parseFunctionArgs(java.lang.String argString)
static java.lang.String
removeEscapeChars(java.lang.String origKey)
static java.lang.String
removeEscapedValues(java.lang.String origKey)
static java.util.Iterator<java.lang.Character>
stringIterator(java.lang.String string)
Helper method to turn a String into an Iterator
-
-
-
Method Detail
-
parseDotNotation
public static java.util.List<java.lang.String> parseDotNotation(java.util.List<java.lang.String> pathStrings, java.util.Iterator<java.lang.Character> iter, java.lang.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 PathElementiter
- the iterator to pull characters fromdotNotationRef
- the original dotNotation string used for error messages- Returns:
- evaluated List
from dot notation string spec
-
stringIterator
public static java.util.Iterator<java.lang.Character> stringIterator(java.lang.String string)
Helper method to turn a String into an Iterator
-
fixLeadingBracketSugar
public static java.lang.String fixLeadingBracketSugar(java.lang.String dotNotaton)
Given a dotNotation style outputPath like "data[2].&(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 java.lang.String parseAtPathElement(java.util.Iterator<java.lang.Character> iter, java.lang.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 fromdotNotationRef
- the original dotNotation string used for error messages
-
removeEscapedValues
public static java.lang.String removeEscapedValues(java.lang.String origKey)
-
removeEscapeChars
public static java.lang.String removeEscapeChars(java.lang.String origKey)
-
parseFunctionArgs
public static java.util.List<java.lang.String> parseFunctionArgs(java.lang.String argString)
-
-