Class MatchedElement

  • All Implemented Interfaces:
    EvaluatablePathElement, PathElement
    Direct Known Subclasses:
    ArrayMatchedElement

    public class MatchedElement
    extends BasePathElement
    implements EvaluatablePathElement
    MatchedElement is the result of a "match" between a spec PathElement and some input data. MatchedElements are not thread safe, and should instead be stack / single Thread/Transform specific. This mutability was specifically added for the the HashCount functionality, which allows Shiftr to transform data form maps to lists.
    • Field Detail

      • subKeys

        private final java.util.List<java.lang.String> subKeys
      • hashCount

        private int hashCount
    • Constructor Detail

      • MatchedElement

        public MatchedElement​(java.lang.String key)
      • MatchedElement

        public MatchedElement​(java.lang.String key,
                              java.util.List<java.lang.String> subKeys)
    • Method Detail

      • evaluate

        public java.lang.String evaluate​(WalkedPath walkedPath)
        Description copied from interface: EvaluatablePathElement
        Evaluate this key as if it is an write path element.
        Specified by:
        evaluate in interface EvaluatablePathElement
        Parameters:
        walkedPath - "up the tree" list of LiteralPathElements, that may be used by this key as it is computing
        Returns:
        String path element to use for write tree building
      • getCanonicalForm

        public java.lang.String getCanonicalForm()
        Description copied from interface: PathElement
        Get the canonical form of this PathElement. Really only interesting for the Reference Path element, where it will expand "&" to "&0(0)".
        Specified by:
        getCanonicalForm in interface PathElement
        Returns:
        canonical String version of this PathElement
      • getSubKeyRef

        public java.lang.String getSubKeyRef​(int index)
      • getSubKeyCount

        public int getSubKeyCount()
      • getHashCount

        public int getHashCount()
      • incrementHashCount

        public void incrementHashCount()
        Here be mutability...