Class CompiledPath

java.lang.Object
com.jayway.jsonpath.internal.path.CompiledPath
All Implemented Interfaces:
Path

public class CompiledPath extends Object implements Path
  • Field Details

    • logger

      private static final org.slf4j.Logger logger
    • root

      private final RootPathToken root
    • isRootPath

      private final boolean isRootPath
  • Constructor Details

    • CompiledPath

      public CompiledPath(RootPathToken root, boolean isRootPath)
  • Method Details

    • isRootPath

      public boolean isRootPath()
      Specified by:
      isRootPath in interface Path
      Returns:
      true id this path is starts with '$' and false if the path starts with '@'
    • invertScannerFunctionRelationship

      private RootPathToken invertScannerFunctionRelationship(RootPathToken path)
      In the event the writer of the path referenced a function at the tail end of a scanner, augment the query such that the root node is the function and the parameter to the function is the scanner. This way we maintain relative sanity in the path expression, functions either evaluate scalar values or arrays, they're not re-entrant nor should they maintain state, they do however take parameters.
      Parameters:
      path - this is our old root path which will become a parameter (assuming there's a scanner terminated by a function
      Returns:
      A function with the scanner as input, or if this situation doesn't exist just the input path
    • evaluate

      public EvaluationContext evaluate(Object document, Object rootDocument, Configuration configuration, boolean forUpdate)
      Description copied from interface: Path
      Evaluates this path
      Specified by:
      evaluate in interface Path
      Parameters:
      document - the json document to apply the path on
      rootDocument - the root json document that started this evaluation
      configuration - configuration to use
      forUpdate - is this a read or a write operation
      Returns:
      EvaluationContext containing results of evaluation
    • evaluate

      public EvaluationContext evaluate(Object document, Object rootDocument, Configuration configuration)
      Description copied from interface: Path
      Evaluates this path
      Specified by:
      evaluate in interface Path
      Parameters:
      document - the json document to apply the path on
      rootDocument - the root json document that started this evaluation
      configuration - configuration to use
      Returns:
      EvaluationContext containing results of evaluation
    • isDefinite

      public boolean isDefinite()
      Specified by:
      isDefinite in interface Path
      Returns:
      true id this path is definite
    • isFunctionPath

      public boolean isFunctionPath()
      Specified by:
      isFunctionPath in interface Path
      Returns:
      true id this path is a function
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getRoot

      public RootPathToken getRoot()