Class GeneratorWriter<W extends GeneratorWriter<W>>

  • Direct Known Subclasses:
    JavaWriter, TextWriter

    public abstract class GeneratorWriter<W extends GeneratorWriter<W>>
    extends Object
    A wrapper for a PrintWriter

    This wrapper postpones the actual write to the wrapped PrintWriter until all information about the target Java class is available. This way, the import dependencies can be calculated at the end.

    Author:
    Lukas Eder
    • Constructor Detail

      • GeneratorWriter

        protected GeneratorWriter​(File file)
      • GeneratorWriter

        protected GeneratorWriter​(File file,
                                  String encoding)
      • GeneratorWriter

        protected GeneratorWriter​(File file,
                                  Files files)
      • GeneratorWriter

        protected GeneratorWriter​(File file,
                                  String encoding,
                                  Files files)
    • Method Detail

      • tabString

        public String tabString()
      • tabString

        public void tabString​(String string)
      • newlineString

        public String newlineString()
      • newlineString

        public void newlineString​(String string)
      • printMarginForBlockComment

        public int printMarginForBlockComment()
      • printMarginForBlockComment

        public void printMarginForBlockComment​(int i)
      • file

        public File file()
      • print

        public W print​(char value)
      • print

        public W print​(int value)
      • print

        public W print​(String string)
      • printlnIf

        public W printlnIf​(boolean condition)
      • println

        public W println()
      • println

        public W println​(int value)
      • println

        public W println​(String string)
      • indentInc

        public W indentInc()
      • indentDec

        public W indentDec()
      • indent

        public W indent​(int tabs)
      • indent

        public int indent()
      • tab

        public W tab​(int tabs)
      • tab

        public int tab()
      • encoding

        protected String encoding()
      • beforeClose

        protected String beforeClose​(String string)
      • ref

        public String[] ref​(String[] clazzOrId)
        Get a reference to a list of Class.
      • ref

        public List<String> ref​(List<String> clazzOrId)
        Get a reference to a list of Class.

        Subtypes may override this to generate import statements.

      • ref

        protected String ref​(String clazzOrId,
                             int keepSegments)
        Get a reference to a Class.
      • ref

        protected String[] ref​(String[] clazzOrId,
                               int keepSegments)
        Get a reference to a list of Class.
      • ref

        protected List<String> ref​(List<String> clazzOrId,
                                   int keepSegments)
        Get a reference to a list of Class.

        Subtypes may override this to generate import statements.

      • content

        public String content()