Class FormattingJavaFileObject

  • All Implemented Interfaces:
    javax.tools.FileObject, javax.tools.JavaFileObject

    final class FormattingJavaFileObject
    extends javax.tools.ForwardingJavaFileObject<javax.tools.JavaFileObject>
    A JavaFileObject decorator which formats source code.
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface javax.tools.JavaFileObject

        javax.tools.JavaFileObject.Kind
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static int DEFAULT_FILE_SIZE
      A rough estimate of the average file size: 80 chars per line, 500 lines.
      private Formatter formatter  
      private javax.annotation.processing.Messager messager  
      • Fields inherited from class javax.tools.ForwardingFileObject

        fileObject
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.io.Writer openWriter()  
      • Methods inherited from class javax.tools.ForwardingJavaFileObject

        getAccessLevel, getKind, getNestingKind, isNameCompatible
      • Methods inherited from class javax.tools.ForwardingFileObject

        delete, getCharContent, getLastModified, getName, openInputStream, openOutputStream, openReader, toUri
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface javax.tools.FileObject

        delete, getCharContent, getLastModified, getName, openInputStream, openOutputStream, openReader, toUri
    • Field Detail

      • DEFAULT_FILE_SIZE

        private static final int DEFAULT_FILE_SIZE
        A rough estimate of the average file size: 80 chars per line, 500 lines.
        See Also:
        Constant Field Values
      • formatter

        private final Formatter formatter
      • messager

        private final javax.annotation.processing.Messager messager
    • Constructor Detail

      • FormattingJavaFileObject

        FormattingJavaFileObject​(javax.tools.JavaFileObject delegate,
                                 Formatter formatter,
                                 @Nullable javax.annotation.processing.Messager messager)
        Parameters:
        delegate - JavaFileObject to decorate
        messager - to log messages with.
    • Method Detail

      • openWriter

        public java.io.Writer openWriter()
                                  throws java.io.IOException
        Specified by:
        openWriter in interface javax.tools.FileObject
        Overrides:
        openWriter in class javax.tools.ForwardingFileObject<javax.tools.JavaFileObject>
        Throws:
        java.io.IOException