Interface TraversalStep<StepType,DataType>

All Known Implementing Classes:
ArrayTraversalStep, AutoExpandArrayTraversalStep, BaseTraversalStep, MapTraversalStep

public interface TraversalStep<StepType,DataType>
A step in a JSON tree traversal.
  • Method Details

    • get

      Optional<DataType> get(StepType tree, String key)
      Return the data for the key from the provided tree object.
      Returns:
      data object if available, or null.
    • remove

      Optional<DataType> remove(StepType tree, String key)
      Remove and return the data for the key from the provided tree object.
      Returns:
      data object if available, or null.
    • overwriteSet

      Optional<DataType> overwriteSet(StepType tree, String key, DataType data)
      Insert the data into the tree, overwriting any data that is there.
      Returns:
      returns the data object if successful or null if it could not
    • getChild

      TraversalStep getChild()
      Returns:
      the child Traversal or null if this Traversal has no child
    • newContainer

      StepType newContainer()
      Create a new mutable Map or List, suitable for this PathElement to traverse.
      Returns:
      new List or Map, depending on the type of the Traversal
    • getStepType

      Class<?> getStepType()
      Return the Class of the Generic T, so that it can be used in an "instanceof" style check.
      Returns:
      Class that matches Generic parameter T
    • traverse

      The meat of the Traversal. Pull a key from the iterator, use it to make the traversal, and then call traverse on your child Traversal.
      Parameters:
      tree - tree of data to walk
      op - the Operation to perform is this is the last node of the Traversal
      keys - keys to use
      data - the data to place if the operation is SET
      Returns:
      if SET, null for fail or the "data" object for ok. if GET, PANTS