public interface HasParentNode<T> extends Observable
| Modifier and Type | Method and Description |
|---|---|
default <N> Optional<N> |
findAncestor(Class<N>... types)
Walks the parents of this node and returns the first node of type
type, or empty() if none is
found. |
default <N> Optional<N> |
findAncestor(Class<N> type,
Predicate<N> predicate)
Deprecated.
This method is no longer acceptable to find ancestor.
Use |
default <N> Optional<N> |
findAncestor(Predicate<N> predicate,
Class<N>... types)
Walks the parents of this node and returns the first node that matches one of types
types, or
empty() if none is found. |
Optional<Node> |
getParentNode()
Returns the parent node, or
Optional.empty if no parent is set. |
Node |
getParentNodeForChildren()
Returns the parent node from the perspective of the children of this node.
|
default boolean |
hasParentNode()
Returns true if the parent has a parent
|
default boolean |
isDescendantOf(Node ancestor)
Determines whether this
HasParentNode node is a descendant of the given node. |
T |
setParentNode(Node parentNode)
Sets the parent node.
|
isRegistered, register, unregisterdefault boolean hasParentNode()
Optional<Node> getParentNode()
Optional.empty if no parent is set.T setParentNode(Node parentNode)
parentNode - the parent node, or null to set no parent.thisNode getParentNodeForChildren()
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).
default <N> Optional<N> findAncestor(Class<N>... types)
type, or empty() if none is
found. The given type may also be an interface type, such as one of the NodeWith... interface types.@Deprecated default <N> Optional<N> findAncestor(Class<N> type, Predicate<N> predicate)
Use findAncestor(Predicate, Class) instead.
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.default <N> Optional<N> findAncestor(Predicate<N> predicate, Class<N>... types)
types, or
empty() if none is found. The given type may also be an interface type, such as one of the
NodeWith... interface types.N - default boolean isDescendantOf(Node ancestor)
HasParentNode node is a descendant of the given node. A node is not a
descendant of itself.ancestor - the node for which to determine whether it has this node as an ancestor.true if this node is a descendant of the given node, and false otherwise.Node.isAncestorOf(Node)Copyright © 2007–2024. All rights reserved.