Interface DocumentIteratorVisitor<T>

    • Method Detail

      • prepare

        DocumentIteratorVisitor<T> prepare()
        Prepares the internal state of this visitor for a(nother) visit.

        By specification, it must be safe to call this method any number of times.

        Returns:
        this visitor.
      • newArray

        T[] newArray​(int len)
        Builds an array of given length of type T.

        Because of erasure, generic classes in Java cannot allocate arrays of generic types. This impossibility can be a problem if for some reason the visitPost() methods expect an actual array of type T. This method must provide an array of given length that is an acceptable input for all visitPost() methods.

        Note that by declaring an implementing class of this interface that has a sole constructor accepting an argument of type Class<T>, you will force the user to provide the class of the generic type, opening the way for the reflective methods in Array.

        Parameters:
        len - the required array length.
        Returns:
        an array of type T of length len, or null if this document iterator visitor does not return values.
      • visitPre

        boolean visitPre​(DocumentIterator documentIterator)
        Visits an internal node before recursing into the corresponding subtree.
        Parameters:
        documentIterator - the internal node to be visited.
        Returns:
        true if the visit should continue.
      • visitPost

        T visitPost​(DocumentIterator documentIterator,
                    T[] subNodeResult)
        Visits an internal node after recursing into the corresponding subtree.
        Parameters:
        documentIterator - the internal node to be visited.
        subNodeResult - the array of results returned by subnodes.
        Returns:
        an appropriate return value (usually, the object built using the elements in subNode) if the visit should continue, or null.
      • visit

        T visit​(IndexIterator indexIterator)
         throws IOException
        Visits an IndexIterator leaf.
        Parameters:
        indexIterator - the leaf to be visited.
        Returns:
        an appropriate return value if the visit should continue, or null.
        Throws:
        IOException