Class XMPIteratorImpl.NodeIterator

java.lang.Object
com.itextpdf.kernel.xmp.impl.XMPIteratorImpl.NodeIterator
All Implemented Interfaces:
Iterator
Direct Known Subclasses:
XMPIteratorImpl.NodeIteratorChildren
Enclosing class:
XMPIteratorImpl

private class XMPIteratorImpl.NodeIterator extends Object implements Iterator
The XMPIterator implementation. It first returns the node itself, then recursivly the children and qualifier of the node.
Since:
29.06.2006
  • Field Details

    • ITERATE_NODE

      protected static final int ITERATE_NODE
      iteration state
      See Also:
    • ITERATE_CHILDREN

      protected static final int ITERATE_CHILDREN
      iteration state
      See Also:
    • ITERATE_QUALIFIER

      protected static final int ITERATE_QUALIFIER
      iteration state
      See Also:
    • state

      private int state
      the state of the iteration
    • visitedNode

      private XMPNode visitedNode
      the currently visited node
    • path

      private String path
      the recursively accumulated path
    • childrenIterator

      private Iterator childrenIterator
      the iterator that goes through the children and qualifier list
    • index

      private int index
      index of node with parent, only interesting for arrays
    • subIterator

      private Iterator subIterator
      the iterator for each child
    • returnProperty

      private XMPPropertyInfo returnProperty
      the cached PropertyInfo to return
  • Constructor Details

    • NodeIterator

      public NodeIterator()
      Default constructor
    • NodeIterator

      public NodeIterator(XMPNode visitedNode, String parentPath, int index)
      Constructor for the node iterator.
      Parameters:
      visitedNode - the currently visited node
      parentPath - the accumulated path of the node
      index - the index within the parent node (only for arrays)
  • Method Details

    • hasNext

      public boolean hasNext()
      Prepares the next node to return if not already done.
      Specified by:
      hasNext in interface Iterator
      See Also:
    • reportNode

      protected boolean reportNode()
      Sets the returnProperty as next item or recurses into hasNext().
      Returns:
      Returns if there is a next item to return.
    • iterateChildren

      private boolean iterateChildren(Iterator iterator)
      Handles the iteration of the children or qualfier
      Parameters:
      iterator - an iterator
      Returns:
      Returns if there are more elements available.
    • next

      public Object next()
      Calls hasNext() and returnes the prepared node. Afterwards its set to null. The existance of returnProperty indicates if there is a next node, otherwise an exceptio is thrown.
      Specified by:
      next in interface Iterator
      See Also:
    • remove

      public void remove()
      Not supported.
      Specified by:
      remove in interface Iterator
      See Also:
    • accumulatePath

      protected String accumulatePath(XMPNode currNode, String parentPath, int currentIndex)
      Parameters:
      currNode - the node that will be added to the path.
      parentPath - the path up to this node.
      currentIndex - the current array index if an arrey is traversed
      Returns:
      Returns the updated path.
    • createPropertyInfo

      protected XMPPropertyInfo createPropertyInfo(XMPNode node, String baseNS, String path)
      Creates a property info object from an XMPNode.
      Parameters:
      node - an XMPNode
      baseNS - the base namespace to report
      path - the full property path
      Returns:
      Returns a XMPProperty-object that serves representation of the node.
    • getChildrenIterator

      protected Iterator getChildrenIterator()
      Returns:
      the childrenIterator
    • setChildrenIterator

      protected void setChildrenIterator(Iterator childrenIterator)
      Parameters:
      childrenIterator - the childrenIterator to set
    • getReturnProperty

      protected XMPPropertyInfo getReturnProperty()
      Returns:
      Returns the returnProperty.
    • setReturnProperty

      protected void setReturnProperty(XMPPropertyInfo returnProperty)
      Parameters:
      returnProperty - the returnProperty to set