org.apache.karaf.shell.dev.util
Class Tree<T>

java.lang.Object
  extended by org.apache.karaf.shell.dev.util.Node<T>
      extended by org.apache.karaf.shell.dev.util.Tree<T>

public class Tree<T>
extends Node<T>

Represents a tree that can be written to the console. The output will look like this:

 root
 +- child1
 |  +- grandchild
 +- child2
 


Nested Class Summary
static interface Tree.Converter<T>
          Interface to convert node values to string
 
Constructor Summary
Tree(T root)
          Creates a new tree with the given root node
 
Method Summary
 void write(java.io.PrintStream stream)
          Write the tree to a PrintStream, using the default toString() method to output the node values
 void write(java.io.PrintStream stream, Tree.Converter<T> converter)
          Write the tree to a PrintStream, using the provided converter to output the node values
 void write(java.io.PrintWriter writer)
          Write the tree to a PrintWriter, using the default toString() method to output the node values
 void write(java.io.PrintWriter writer, Tree.Converter<T> converter)
          Write the tree to a PrintWriter, using the provided converter to output the node values
 
Methods inherited from class org.apache.karaf.shell.dev.util.Node
addChild, flatten, getChildren, getValue, hasAncestor, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Tree

public Tree(T root)
Creates a new tree with the given root node

Parameters:
root - the root node
Method Detail

write

public void write(java.io.PrintStream stream)
Write the tree to a PrintStream, using the default toString() method to output the node values

Parameters:
stream -

write

public void write(java.io.PrintStream stream,
                  Tree.Converter<T> converter)
Write the tree to a PrintStream, using the provided converter to output the node values

Parameters:
stream -
converter -

write

public void write(java.io.PrintWriter writer)
Write the tree to a PrintWriter, using the default toString() method to output the node values

Parameters:
writer -

write

public void write(java.io.PrintWriter writer,
                  Tree.Converter<T> converter)
Write the tree to a PrintWriter, using the provided converter to output the node values

Parameters:
writer -
converter -


Copyright © 2007-2011 Apache Software Foundation. All Rights Reserved.