Package com.bazaarvoice.jolt.common
Class PathEvaluatingTraversal
- java.lang.Object
-
- com.bazaarvoice.jolt.common.PathEvaluatingTraversal
-
- Direct Known Subclasses:
ShiftrWriter
,TransposeReader
public abstract class PathEvaluatingTraversal extends java.lang.Object
Combines a Traversr with the ability to evaluate References against a WalkedPath. Convenience class for path based off a single dot notation String, like "rating.&1(2).&.value". This processes the dot notation path into internal data structures, so that the String processing only happens once.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<EvaluatablePathElement>
elements
private Traversr
traversr
-
Constructor Summary
Constructors Constructor Description PathEvaluatingTraversal(java.lang.String dotNotation)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract Traversr
createTraversr(java.util.List<java.lang.String> paths)
java.util.List<java.lang.String>
evaluate(WalkedPath walkedPath)
Use the supplied WalkedPath, in the evaluation of each of our PathElements.PathElement
get(int index)
java.lang.String
getCanonicalForm()
Testing method.Optional<java.lang.Object>
read(java.lang.Object data, WalkedPath walkedPath)
int
size()
void
write(java.lang.Object data, java.util.Map<java.lang.String,java.lang.Object> output, WalkedPath walkedPath)
Use the supplied WalkedPath, in the evaluation of each of our PathElements to build a concrete output path.
-
-
-
Field Detail
-
elements
private final java.util.List<EvaluatablePathElement> elements
-
traversr
private final Traversr traversr
-
-
Method Detail
-
createTraversr
protected abstract Traversr createTraversr(java.util.List<java.lang.String> paths)
-
write
public void write(java.lang.Object data, java.util.Map<java.lang.String,java.lang.Object> output, WalkedPath walkedPath)
Use the supplied WalkedPath, in the evaluation of each of our PathElements to build a concrete output path. Then use that output path to write the given data to the output.- Parameters:
data
- data to writeoutput
- data structure we are going to write the data towalkedPath
- reference used to lookup reference values like "&1(2)"
-
read
public Optional<java.lang.Object> read(java.lang.Object data, WalkedPath walkedPath)
-
evaluate
public java.util.List<java.lang.String> evaluate(WalkedPath walkedPath)
Use the supplied WalkedPath, in the evaluation of each of our PathElements. If our PathElements contained a TransposePathElement, we may return null.- Parameters:
walkedPath
- used to lookup/evaluate PathElement references values like "&1(2)"- Returns:
- null or fully evaluated Strings, possibly with concrete array references like "photos.[3]"
-
size
public int size()
-
get
public PathElement get(int index)
-
getCanonicalForm
public java.lang.String getCanonicalForm()
Testing method.
-
-