| 
 | BeanIO 2.0.4 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.beanio.internal.util.TreeNode<T>
public class TreeNode<T extends TreeNode>
A basic tree node implementation. Each node holds references to its children, and not its parent, thereby allowing a node to have multiple parents.
Subclasses can override isSupportedChild(TreeNode) to restrict
 a node's children.
 
 
A tree node is not thread safe.  Instead, TreeNode implements 
 Replicateable so that an entire tree structure can be safely copied
 to support multiple independent clients if needed.
| Constructor Summary | |
|---|---|
| TreeNode()Constructs a new TreeNode. | |
| TreeNode(int size)Constructs a new TreeNode. | |
| Method Summary | |
|---|---|
|  void | add(T child)Adds a child to this node. | 
|  T | clone()Clones this node. | 
|  T | find(String name)Recursively finds the first descendant with the given name. | 
|  List<T> | getChildren()Returns the immediate children of this node. | 
|  T | getFirst()Returns the first child of this node. | 
|  String | getName()Returns the name of this node. | 
| protected  boolean | isSupportedChild(T child)Returns whether a node is a supported child of this node. | 
|  Iterator<T> | iterator() | 
|  void | print()Prints this node and its descendants to standard out. | 
|  void | setName(String name)Sets the name of this node. | 
|  int | size()Returns the number of children this node has. | 
|  void | sort(Comparator<? super T> comparator)Sorts all descendants of this node. | 
| protected  void | toParamString(StringBuilder s)Called by toString()to append node parameters to the output. | 
|  String | toString() | 
|  void | updateReferences(Map<Object,Object> map)Updates a node's references to other nodes. | 
| Methods inherited from class java.lang.Object | 
|---|
| equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait | 
| Constructor Detail | 
|---|
public TreeNode()
public TreeNode(int size)
size - the initial size of the node for accommodating children| Method Detail | 
|---|
public String getName()
public void setName(String name)
name - the node namepublic T find(String name)
name - the name of the node to find
public List<T> getChildren()
public Iterator<T> iterator()
iterator in interface Iterable<T extends TreeNode>public T getFirst()
NullPointerException - if this node does not have any children
public void add(T child)
         throws IllegalArgumentException
child - the child to add
IllegalArgumentException - if the child is not supported by this nodepublic int size()
protected boolean isSupportedChild(T child)
add(TreeNode).
child - the node to test
public void sort(Comparator<? super T> comparator)
comparator - the Comparator to use for comparing nodespublic T clone()
Replicateable
clone in interface Replicateableclone in class Objectpublic void updateReferences(Map<Object,Object> map)
Replicateable
updateReferences in interface Replicateablemap - the (identity) map of clones by prior object referencepublic void print()
public String toString()
toString in class Objectprotected void toParamString(StringBuilder s)
toString() to append node parameters to the output.
s - the output to append| 
 | BeanIO 2.0.4 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||