Interface TreeTraverseAction<M extends Map<String,Object>,L extends List<Object>>

All Known Subinterfaces:
JSONTraverseAction
All Known Implementing Classes:
KeysPrintAction, LocatePathsJsonAction, RemoveElementsJsonAction, RemovePathsJsonAction, RetainPathsJsonAction

public interface TreeTraverseAction<M extends Map<String,Object>,L extends List<Object>>
An interface for a processing action on the nodes of a TreeTraverseAction tree while traversing it. The order in which the callbacks are listed below is the order in which they are called by the TreeTraverser

See package-info for more details

Author:
adoneitan@gmail.com
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    end()
    called after the traversal ends, and just before the start(M) method exits
    void
    handleLeaf(String fullPathToContainingList, int listIndex, Object listItem)
    called for each leaf of an L list is encountered
    void
    handleLeaf(String fullPathToEntry, Map.Entry<String,Object> entry)
    called for each leaf of an M map is encountered
    boolean
    recurInto(String fullPathToContainingList, L entryValue)
    called when a non-leaf item is encountered inside an L object
    boolean
    recurInto(String fullPathToSubtree, M entryValue)
    called when a non-leaf entry is encountered inside an M object
    boolean
    removeEntry(String fullPathToEntry, Map.Entry<String,Object> entry)
    the last callback for each entry in an TreeTraverseAction map. if this method returns true the TreeTraverser removes the entry from the map. there is no further handling of the entry.
    holds the result of the traversal, as assigned by the action implementing this interface
    boolean
    start(M object)
    called before any traversal of the TreeTraverseAction tree starts
    boolean
    traverseEntry(String fullPathToEntry, Map.Entry<String,Object> entry)
    called when a new entry is encountered and before any processing is performed on it
  • Method Details

    • start

      boolean start(M object)
      called before any traversal of the TreeTraverseAction tree starts
      Parameters:
      object - TODO
      Returns:
      true if traversal should start at all
    • traverseEntry

      boolean traverseEntry(String fullPathToEntry, Map.Entry<String,Object> entry)
      called when a new entry is encountered and before any processing is performed on it
      Parameters:
      fullPathToEntry - TODO
      entry - TODO
      Returns:
      true if the entry should be processed
    • removeEntry

      boolean removeEntry(String fullPathToEntry, Map.Entry<String,Object> entry)
      the last callback for each entry in an TreeTraverseAction map. if this method returns true the TreeTraverser removes the entry from the map. there is no further handling of the entry.
      Parameters:
      fullPathToEntry - TODO
      entry - TODO
      Returns:
      true if the entry and its subtree should be removed from the M tree
    • recurInto

      boolean recurInto(String fullPathToSubtree, M entryValue)
      called when a non-leaf entry is encountered inside an M object
      Parameters:
      fullPathToSubtree - TODO
      entryValue - TODO
      Returns:
      true if the non-leaf entry should be recursively traversed
    • recurInto

      boolean recurInto(String fullPathToContainingList, L entryValue)
      called when a non-leaf item is encountered inside an L object
      Parameters:
      fullPathToContainingList - TODO
      entryValue - TODO
      Returns:
      true if the non-leaf item should be recursively traversed
    • handleLeaf

      void handleLeaf(String fullPathToEntry, Map.Entry<String,Object> entry)
      called for each leaf of an M map is encountered
      Parameters:
      fullPathToEntry - TODO
      entry - TODO
    • handleLeaf

      void handleLeaf(String fullPathToContainingList, int listIndex, Object listItem)
      called for each leaf of an L list is encountered
      Parameters:
      fullPathToContainingList - - the item
      listIndex - - the ordered location of the item in the list
      listItem - -
    • end

      void end()
      called after the traversal ends, and just before the start(M) method exits
    • result

      Object result()
      holds the result of the traversal, as assigned by the action implementing this interface
      Returns:
      result