Class JavaOutput


public final class JavaOutput extends Output
JavaOutput extends Output to represent a Java output document. It includes methods to emit the output document.
  • Constructor Details

    • JavaOutput

      public JavaOutput(JavaInput javaInput, InputMetadata inputMetadata)
      JavaOutput constructor.
      Parameters:
      javaInput - the JavaInput, used to match up blank lines in the output
  • Method Details

    • append

      public void append(State state, String text, com.google.common.collect.Range<Integer> range)
      Description copied from class: Output
      Output a string.
      Specified by:
      append in class Output
      Parameters:
      state - the current state
      text - the string
      range - the Range corresponding to the string
    • indent

      public void indent(int indent)
      Description copied from class: Output
      Indent by outputting indent spaces.
      Specified by:
      indent in class Output
      Parameters:
      indent - the current indent
    • getFormatReplacements

      public com.google.common.collect.ImmutableList<com.palantir.javaformat.java.Replacement> getFormatReplacements(com.google.common.collect.RangeSet<Integer> iRangeSet0)
      Emit a list of Replacements to convert from input to output.
      Returns:
      a list of Replacements, sorted by start index, without overlaps
    • startPosition

      public static int startPosition(Input.Token token)
      The earliest position of any Tok in the Token, including leading whitespace.
    • startTok

      public static Input.Tok startTok(Input.Token token)
      The earliest non-whitespace Tok in the Token.
    • endTok

      public static Input.Tok endTok(Input.Token token)
      The last non-whitespace Tok in the Token.
    • toString

      public String toString()
      Overrides:
      toString in class Output