Interface TokenWriter

All Known Implementing Classes:
DefaultTokenWriter, MutableTokenWriter, TokenWriterProxy

public interface TokenWriter
Responsible for writing a token while pretty-printing. Default is DefaultTokenWriter, can be provided by client too.
  • Method Details

    • writeSeparator

      TokenWriter writeSeparator(String token)
      Writes one separator. It is -> or :: or one of these characters: (){}[];,.:@=<>?&|
    • writeOperator

      TokenWriter writeOperator(String token)
      Writes one operator. = > < ! ~ ? : == <= >= != && || ++ -- + - * / & | ^ % << >> >>> += -= *= /= &= |= ^= %= <<= >>= >>>= instanceof
    • writeLiteral

      TokenWriter writeLiteral(String token)
      writes literal. It can be a String, Character or an number
    • writeKeyword

      TokenWriter writeKeyword(String token)
      writes a keyword abstract continue for new switch assert default goto package synchronized boolean do if private this break double implements protected throw byte else import public throws case enum instanceof return transient catch extends int short try char final interface static void class finally long strictfp volatile const float native super while
    • writeIdentifier

      TokenWriter writeIdentifier(String token)
      writes a java identifier.
    • writeCodeSnippet

      TokenWriter writeCodeSnippet(String token)
      writes a code snippet - represents arbitrary code of CtCodeSnippetExpression or CtCodeSnippetStatement
    • writeComment

      TokenWriter writeComment(CtComment comment)
      writes a comment
    • writeln

      TokenWriter writeln()
      writes new line (EOL)
    • incTab

      TokenWriter incTab()
      increments indentation
    • decTab

      TokenWriter decTab()
      decrements indentation
    • getPrinterHelper

      PrinterHelper getPrinterHelper()
      Returns:
      PrinterHelper used by this TokenWriter. Note that in the future, will return an interface eg IPrinterHelper instead.
    • reset

      void reset()
      resets to the initial state
    • writeSpace

      TokenWriter writeSpace()
      Writes a single space.