java.lang.Object
com.google.googlejavaformat.InputOutput
com.google.googlejavaformat.Output
com.google.googlejavaformat.java.JavaOutput
JavaOutput
extends Output
to represent a Java output document. It includes
methods to emit the output document.-
Nested Class Summary
Nested classes/interfaces inherited from class com.google.googlejavaformat.Output
Output.BreakTag
-
Field Summary
Fields inherited from class com.google.googlejavaformat.InputOutput
EMPTY_RANGE, ranges
-
Constructor Summary
ConstructorsConstructorDescriptionJavaOutput
(String lineSeparator, Input javaInput, CommentsHelper commentsHelper) JavaOutput
constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Output a string.static String
applyReplacements
(String input, List<Replacement> replacements) void
blankLine
(int k, OpsBuilder.BlankLineWanted wanted) A blank line is or is not wanted here.static Input.Tok
endTok
(Input.Token token) The last non-whitespace Tok in the Token.void
flush()
Flush any incomplete last line, then add the EOF token into our data structures.Get theCommentsHelper
.getFormatReplacements
(RangeSet<Integer> iRangeSet0) Emit a list ofReplacement
s to convert from input to output.void
indent
(int indent) Indent by outputtingindent
spaces.void
markForPartialFormat
(Input.Token start, Input.Token end) Marks a region that can be partially formatted.static int
startPosition
(Input.Token token) The earliest position of any Tok in the Token, including leading whitespace.static Input.Tok
startTok
(Input.Token token) The earliest non-whitespace Tok in the Token.toString()
Methods inherited from class com.google.googlejavaformat.InputOutput
computeRanges, getLine, getLineCount, getRanges, makeKToIJ, setLines
-
Constructor Details
-
JavaOutput
JavaOutput
constructor.- Parameters:
javaInput
- theInput
, used to match up blank lines in the outputcommentsHelper
- theCommentsHelper
, used to rewrite comments
-
-
Method Details
-
blankLine
Description copied from class:Output
A blank line is or is not wanted here. -
markForPartialFormat
Description copied from class:Output
Marks a region that can be partially formatted.- Specified by:
markForPartialFormat
in classOutput
-
append
Description copied from class:Output
Output a string. -
indent
public void indent(int indent) Description copied from class:Output
Indent by outputtingindent
spaces. -
flush
public void flush()Flush any incomplete last line, then add the EOF token into our data structures. -
getCommentsHelper
Description copied from class:Output
Get theCommentsHelper
.- Specified by:
getCommentsHelper
in classOutput
- Returns:
- the
CommentsHelper
-
getFormatReplacements
Emit a list ofReplacement
s to convert from input to output.- Returns:
- a list of
Replacement
s, sorted by start index, without overlaps
-
applyReplacements
-
startPosition
The earliest position of any Tok in the Token, including leading whitespace. -
startTok
The earliest non-whitespace Tok in the Token. -
endTok
The last non-whitespace Tok in the Token. -
toString
-