Class 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.
    • 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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PathEvaluatingTraversal

        public PathEvaluatingTraversal​(java.lang.String dotNotation)
    • 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 write
        output - data structure we are going to write the data to
        walkedPath - 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()
      • getCanonicalForm

        public java.lang.String getCanonicalForm()
        Testing method.