Interface HasParentNode<T>

    • Method Detail

      • getParentNode

        Optional<Node> getParentNode()
        Returns the parent node, or Optional.empty if no parent is set.
      • setParentNode

        T setParentNode​(Node parentNode)
        Sets the parent node.
        Parameters:
        parentNode - the parent node, or null to set no parent.
        Returns:
        return this
      • getParentNodeForChildren

        Node getParentNodeForChildren()
        Returns the parent node from the perspective of the children of this node.

        That is, this method returns this for everything except NodeList. A NodeList returns its parent node instead. This is because a NodeList sets the parent of all its children to its own parent node (see NodeList for details).

      • findAncestor

        default <N> Optional<N> findAncestor​(Class<N> type)
        Walks the parents of this node and returns the first node of type type, or empty() if none is found. The given type may also be an interface type, such as one of the NodeWith... interface types.
      • findAncestor

        default <N> Optional<N> findAncestor​(Class<N> type,
                                             Predicate<N> predicate)
        Walks the parents of this node and returns the first node of type type that matches predicate, or empty() if none is found. The given type may also be an interface type, such as one of the NodeWith... interface types.