Class PrettyTree
- java.lang.Object
-
- org.opendaylight.yangtools.concepts.PrettyTree
-
- Direct Known Subclasses:
NormalizedNodePrettyTree
@Beta public abstract class PrettyTree extends Object implements Supplier<String>
A capture of a tree-like construct, which can be formatted into a pretty-printed tree. The string can be acquired viaget()
.This concept is purposefully designed as an abstract class which defers its
toString()
toget()
, as it allows convenient and light-weight use with logging:PrettyTreeAware treeLike; LOG.debug("Tree is {}", treeLike.prettyTree());
-
-
Constructor Summary
Constructors Constructor Description PrettyTree()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected static void
appendIndent(StringBuilder sb, int depth)
Append a number of spaces equivalent to specified tree nesting depth into the specifiedStringBuilder
.abstract void
appendTo(StringBuilder sb, int depth)
Format this object into specifiedStringBuilder
starting at specified initial depth.@NonNull String
get()
@NonNull String
toString()
-
-
-
Method Detail
-
appendTo
public abstract void appendTo(StringBuilder sb, int depth)
Format this object into specifiedStringBuilder
starting at specified initial depth.- Parameters:
sb
- TargetStringBuilder
depth
- Initial nesting depth- Throws:
NullPointerException
- ifsb
is nullIllegalArgumentException
- ifdepth
is negative
-
appendIndent
protected static final void appendIndent(StringBuilder sb, int depth)
Append a number of spaces equivalent to specified tree nesting depth into the specifiedStringBuilder
.- Parameters:
sb
- TargetStringBuilder
depth
- Nesting depth- Throws:
NullPointerException
- ifsb
is nullIllegalArgumentException
- ifdepth
is negative
-
-