Package com.mapr.utils
Class PrettyStringBuilder
- java.lang.Object
-
- com.mapr.utils.IndentingStringBuilder
-
- com.mapr.utils.PrettyStringBuilder
-
public class PrettyStringBuilder extends IndentingStringBuilder
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 Constructor Description PrettyStringBuilder(java.lang.StringBuilder sb, int indentSpaces)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IndentingStringBuilderaddComment(java.lang.String comment)Add a c-style comment.IndentingStringBuildernextLine()Emit a newline, along with any necessary indentation.IndentingStringBuilderpopIndent()Remove a level of indentation.IndentingStringBuilderpushIndent()Add a new level of indentation.
-
-
-
Method Detail
-
nextLine
public IndentingStringBuilder nextLine()
Description copied from class:IndentingStringBuilderEmit a newline, along with any necessary indentation.- Specified by:
nextLinein classIndentingStringBuilder- Returns:
- this
-
pushIndent
public IndentingStringBuilder 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
public IndentingStringBuilder 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
public IndentingStringBuilder addComment(java.lang.String comment)
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:
-
-