Class PathEvaluatingTraversal

java.lang.Object
com.bazaarvoice.jolt.common.PathEvaluatingTraversal
Direct Known Subclasses:
ShiftrWriter, TransposeReader

public abstract class PathEvaluatingTraversal extends 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.invalid input: '&'1(2).invalid input: '&'.value". This processes the dot notation path into internal data structures, so that the String processing only happens once.
  • Field Details

  • Constructor Details

    • PathEvaluatingTraversal

      public PathEvaluatingTraversal(String dotNotation)
  • Method Details

    • createTraversr

      protected abstract Traversr createTraversr(List<String> paths)
    • write

      public void write(Object data, Map<String,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 write
      output - data structure we are going to write the data to
      walkedPath - reference used to lookup reference values like "invalid input: '&'1(2)"
    • read

      public Optional<Object> read(Object data, WalkedPath walkedPath)
    • evaluate

      public List<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 "invalid input: '&'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 String getCanonicalForm()
      Testing method.