org.sitemesh.content
Interface TreeNode<T extends TreeNode>

All Known Subinterfaces:
ContentProperty

public interface TreeNode<T extends TreeNode>

Represents a node of a tree-like data structure.

Author:
Joe Walnes

Method Summary
 T getChild(String name)
          Get child by name, in relation to this node.
 Iterable<T> getChildren()
          Get immediate children of this node.
 Iterable<T> getDescendants()
          Get all descendants of this node.
 T[] getFullPath()
          Get the full path of this node, from the root node.
 String getName()
          Get the name of this node, in relation to the parent.
 T getParent()
          Returns the parent node.
 boolean hasChild(String name)
          Returns whether the child node exists.
 boolean hasChildren()
          Returns whether this node has any child nodes.
 

Method Detail

getName

String getName()
Get the name of this node, in relation to the parent.


getFullPath

T[] getFullPath()
Get the full path of this node, from the root node.


getParent

T getParent()
Returns the parent node. If this is the root node, null will be returned.


hasChildren

boolean hasChildren()
Returns whether this node has any child nodes.


hasChild

boolean hasChild(String name)
Returns whether the child node exists.


getChild

T getChild(String name)
Get child by name, in relation to this node.

If the child does not already exist, a new one shall be automatically created. If this is not the preferred behavior, you should use hasChild(String) first.


getChildren

Iterable<T> getChildren()
Get immediate children of this node.

This does not include grandchildren (use getDescendants() instead).


getDescendants

Iterable<T> getDescendants()
Get all descendants of this node.

This includes grandchildren, great-grandchildren, etc (use getChildren() if you just want the immediate children).



Copyright © 2011. All Rights Reserved.