Class TreeStatus

java.lang.Object
org.apache.pdfbox.debugger.treestatus.TreeStatus

public final class TreeStatus extends Object
  • Field Details

    • rootNode

      private Object rootNode
  • Constructor Details

    • TreeStatus

      private TreeStatus()
    • TreeStatus

      public TreeStatus(Object rootNode)
      Constructor.
      Parameters:
      rootNode - the root node of the tree which will be used to construct a treepath from a tree status string.
  • Method Details

    • getStringForPath

      public String getStringForPath(TreePath path)
      Provides status string for a TreePath instance.
      Parameters:
      path - TreePath instance.
      Returns:
      pathString.
    • getPathForString

      public TreePath getPathForString(String statusString)
      Provides TreePath for a given status string. In case of invalid string returns null.
      Parameters:
      statusString -
      Returns:
      path.
    • generatePathString

      private String generatePathString(TreePath path)
      Constructs a status string from the path.
      Parameters:
      path -
      Returns:
      the status string.
    • generatePath

      private TreePath generatePath(String pathString)
      Constructs TreePath from Status String.
      Parameters:
      pathString -
      Returns:
      a TreePath, or null if there is an error.
    • getObjectName

      private String getObjectName(Object treeNode)
      Get the object name of a tree node. If the given node of the tree is a MapEntry, its key is used as node identifier; if it is an ArrayEntry, then its index is used as identifier.
      Parameters:
      treeNode - node of a tree.
      Returns:
      the name of the node.
      Throws:
      IllegalArgumentException - if there is an unknown treeNode type.
    • parsePathString

      private List<String> parsePathString(String path)
      Parses a string and lists all the nodes.
      Parameters:
      path - a tree path.
      Returns:
      a list of nodes, or null if there is an empty node.
    • searchNode

      private Object searchNode(Object obj, String searchStr)
      An object is searched in the tree structure using the identifiers parsed earlier step.
      Parameters:
      obj -
      searchStr -
      Returns:
      the Object found or null