| Modifier and Type | Field and Description |
|---|---|
| private final StringBuilder | |
| private Position | |
| private final String | |
| private final String | |
| private boolean | |
| private final Deque | |
| private final PrettyPrinterConfiguration. | |
| private String | |
| private final Deque | |
| private final int |
| Access | Constructor and Description |
|---|---|
| pack-priv | |
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| private String | |
| public void | |
| public Position | Returns: the current cursor position (line, column).Return the current cursor position (line, column) in the source printer buffer. |
| public String | |
| public SourcePrinter | indent()
Add the default indentation to the current indentation and push it on the indentation stack. |
| public SourcePrinter | indentWithAlignTo(int column)
Add to the current indentation until it is reaches "column" and push it on the indentation stack. |
| public String | normalizeEolInTextBlock(String content)
Changes all EOL characters in "content" to the EOL character this SourcePrinter is using. |
| public SourcePrinter | |
| public SourcePrinter | |
| public SourcePrinter | Returns: this instance, for nesting calls to method as fluent interfaceAppend a newline to the buffer. |
| public void | reindentToPreviousLevel()
Set the top-most indent to the column the cursor was before the last |
| public void | reindentWithAlignToCursor()
Set the top-most indent to the column the cursor is currently in, can be undone with
|
| public String | Returns: the currently printed source code.Overrides java. |
| public SourcePrinter |
| buf | back to summary |
|---|---|
| private final StringBuilder buf | |
| cursor | back to summary |
|---|---|
| private Position cursor | |
| endOfLineCharacter | back to summary |
|---|---|
| private final String endOfLineCharacter | |
| indentation | back to summary |
|---|---|
| private final String indentation | |
| indented | back to summary |
|---|---|
| private boolean indented | |
| indents | back to summary |
|---|---|
| private final Deque<String> indents | |
| indentType | back to summary |
|---|---|
| private final PrettyPrinterConfiguration. | |
| lastPrintedIndent | back to summary |
|---|---|
| private String lastPrintedIndent | |
| reindentedIndents | back to summary |
|---|---|
| private final Deque<String> reindentedIndents | |
| tabWidth | back to summary |
|---|---|
| private final int tabWidth | |
| SourcePrinter | back to summary |
|---|---|
| pack-priv SourcePrinter() | |
| SourcePrinter | back to summary |
|---|---|
| pack-priv SourcePrinter(final PrettyPrinterConfiguration configuration) | |
| append | back to summary |
|---|---|
| private void append(String arg) | |
| calculateIndentWithAlignTo | back to summary |
|---|---|
| private String calculateIndentWithAlignTo(int column) | |
| duplicateIndent | back to summary |
|---|---|
| public void duplicateIndent() Adds an indent to the top of the stack that is a copy of the current top indent. With this you announce "I'm going to indent the next line(s)" but not how far yet. Once you do know, you can pop this indent ("unindent") and indent to the right column. (Does not actually output anything.) | |
| getCursor | back to summary |
|---|---|
| public Position getCursor() Return the current cursor position (line, column) in the source printer buffer.
Please notice in order to guarantee a correct computation of the cursor position,
this printer expect the contracts of the methods
| |
| getSource | back to summary |
|---|---|
| public String getSource()
Deprecated use toString()
| |
| indent | back to summary |
|---|---|
| public SourcePrinter indent() Add the default indentation to the current indentation and push it on the indentation stack. Does not actually output anything. | |
| indentWithAlignTo | back to summary |
|---|---|
| public SourcePrinter indentWithAlignTo(int column) Add to the current indentation until it is reaches "column" and push it on the indentation stack. Does not actually output anything. | |
| normalizeEolInTextBlock | back to summary |
|---|---|
| public String normalizeEolInTextBlock(String content) Changes all EOL characters in "content" to the EOL character this SourcePrinter is using. | |
| back to summary | |
|---|---|
| public SourcePrinter print(final String arg) Append the source string passed as argument to the buffer. If this is being appended at the beginning of a line, performs indentation first.
The source line to be printed should not contain newline/carriage-return characters;
use
| |
| println | back to summary |
|---|---|
| public SourcePrinter println(final String arg) Append the source string passed as argument to the buffer, then append a newline. If this is being appended at the beginning of a line, performs indentation first.
The source line to be printed should not contain newline/carriage-return characters.
If the source line passed as argument contains newline/carriage-return characters would
impredictably affect a correct computation of the current
| |
| println | back to summary |
|---|---|
| public SourcePrinter println() Append a newline to the buffer.
| |
| reindentToPreviousLevel | back to summary |
|---|---|
| public void reindentToPreviousLevel() Set the top-most indent to the column the cursor was before the last | |
| reindentWithAlignToCursor | back to summary |
|---|---|
| public void reindentWithAlignToCursor() Set the top-most indent to the column the cursor is currently in, can be undone with
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object. | |
| unindent | back to summary |
|---|---|
| public SourcePrinter unindent() Pop the last indentation of the indentation stack. Does not actually output anything. | |