Package com.mapr.utils
Class PlainStringBuilder
- java.lang.Object
-
- com.mapr.utils.IndentingStringBuilder
-
- com.mapr.utils.PlainStringBuilder
-
public class PlainStringBuilder extends IndentingStringBuilder
Implementation ofIndentingStringBuilderthat ignores formatting commands, or only emits single whitespaces as appropriate. Just a plain wrapper for a StringBuilder.
-
-
Field Summary
-
Fields inherited from class com.mapr.utils.IndentingStringBuilder
sb
-
-
Constructor Summary
Constructors Constructor Description PlainStringBuilder(java.lang.StringBuilder sb)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IndentingStringBuilderaddComment(java.lang.String comment)Add a c-style comment.IndentingStringBuilderappend(char c)Append a char.IndentingStringBuilderappend(java.lang.String s)Append a String.IndentingStringBuildernextLine()Emit a newline, along with any necessary indentation.IndentingStringBuilderpopIndent()Remove a level of indentation.IndentingStringBuilderpushIndent()Add a new level of indentation.-
Methods inherited from class com.mapr.utils.IndentingStringBuilder
append, length, toString
-
-
-
-
Method Detail
-
append
public IndentingStringBuilder append(java.lang.String s)
Description copied from class:IndentingStringBuilderAppend a String.- Overrides:
appendin classIndentingStringBuilder- Parameters:
s- the string to append- Returns:
- the IndentingStringBuilder
-
append
public IndentingStringBuilder append(char c)
Description copied from class:IndentingStringBuilderAppend a char.- Overrides:
appendin classIndentingStringBuilder- Parameters:
c- the char to append- Returns:
- the IndentingStringBuilder
-
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
-
nextLine
public IndentingStringBuilder nextLine()
Description copied from class:IndentingStringBuilderEmit a newline, along with any necessary indentation.- Specified by:
nextLinein 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:
-
-