Package com.mapr.utils
Class PrettyStringBuilder
java.lang.Object
com.mapr.utils.IndentingStringBuilder
com.mapr.utils.PrettyStringBuilder
Implementation of IndentingStringBuilder that honors indentation and
space requests for debugging purposes.
-
Field Summary
Fields inherited from class com.mapr.utils.IndentingStringBuilder
sb -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddComment(String comment) Add a c-style comment.nextLine()Emit a newline, along with any necessary indentation.Remove a level of indentation.Add a new level of indentation.
-
Constructor Details
-
PrettyStringBuilder
Constructor.- Parameters:
sb- the StringBuilder to write toindentSpaces- how many spaces to use for indentation
-
-
Method Details
-
nextLine
Description copied from class:IndentingStringBuilderEmit a newline, along with any necessary indentation.- Specified by:
nextLinein classIndentingStringBuilder- Returns:
- this
-
pushIndent
Description copied from class:IndentingStringBuilderAdd a new level of indentation. This has no effect until the next call toIndentingStringBuilder.nextLine().- Specified by:
pushIndentin classIndentingStringBuilder- Returns:
- this
-
popIndent
Description copied from class:IndentingStringBuilderRemove a level of indentation. This has no effect until the next call toIndentingStringBuilder.nextLine(). It is an error to unindent when there are no levels of indentation active; this is indicated with a call toIndentingStringBuilder.addComment(String)with a warning that the caller has unindented too much.- Specified by:
popIndentin classIndentingStringBuilder- Returns:
- this
-
addComment
Description copied from class:IndentingStringBuilderAdd a c-style comment. The provided text is emitted surrounded by "/o " and " o/" (where the o's are asterisks). The comment will only appear in "pretty text." For plain text, this emits a single blank.- Specified by:
addCommentin classIndentingStringBuilder- Parameters:
comment- the comment- Returns:
-