Class FormattingFiler

  • All Implemented Interfaces:
    javax.annotation.processing.Filer

    public final class FormattingFiler
    extends java.lang.Object
    implements javax.annotation.processing.Filer
    A decorating Filer implementation which formats Java source files with a Formatter.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private javax.annotation.processing.Filer delegate  
      private Formatter formatter  
      private javax.annotation.processing.Messager messager  
    • Constructor Summary

      Constructors 
      Constructor Description
      FormattingFiler​(javax.annotation.processing.Filer delegate)  
      FormattingFiler​(javax.annotation.processing.Filer delegate, @Nullable javax.annotation.processing.Messager messager)
      Create a new FormattingFiler.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      javax.tools.JavaFileObject createClassFile​(java.lang.CharSequence name, javax.lang.model.element.Element... originatingElements)  
      javax.tools.FileObject createResource​(javax.tools.JavaFileManager.Location location, java.lang.CharSequence pkg, java.lang.CharSequence relativeName, javax.lang.model.element.Element... originatingElements)  
      javax.tools.JavaFileObject createSourceFile​(java.lang.CharSequence name, javax.lang.model.element.Element... originatingElements)  
      javax.tools.FileObject getResource​(javax.tools.JavaFileManager.Location location, java.lang.CharSequence pkg, java.lang.CharSequence relativeName)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • delegate

        private final javax.annotation.processing.Filer delegate
      • formatter

        private final Formatter formatter
      • messager

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

      • FormattingFiler

        public FormattingFiler​(javax.annotation.processing.Filer delegate)
        Parameters:
        delegate - filer to decorate
      • FormattingFiler

        public FormattingFiler​(javax.annotation.processing.Filer delegate,
                               @Nullable javax.annotation.processing.Messager messager)
        Create a new FormattingFiler. An optional Messager may be specified to make logs more visible.
        Parameters:
        delegate - filer to decorate
        messager - to log warnings to
    • Method Detail

      • createSourceFile

        public javax.tools.JavaFileObject createSourceFile​(java.lang.CharSequence name,
                                                           javax.lang.model.element.Element... originatingElements)
                                                    throws java.io.IOException
        Specified by:
        createSourceFile in interface javax.annotation.processing.Filer
        Throws:
        java.io.IOException
      • createClassFile

        public javax.tools.JavaFileObject createClassFile​(java.lang.CharSequence name,
                                                          javax.lang.model.element.Element... originatingElements)
                                                   throws java.io.IOException
        Specified by:
        createClassFile in interface javax.annotation.processing.Filer
        Throws:
        java.io.IOException
      • createResource

        public javax.tools.FileObject createResource​(javax.tools.JavaFileManager.Location location,
                                                     java.lang.CharSequence pkg,
                                                     java.lang.CharSequence relativeName,
                                                     javax.lang.model.element.Element... originatingElements)
                                              throws java.io.IOException
        Specified by:
        createResource in interface javax.annotation.processing.Filer
        Throws:
        java.io.IOException
      • getResource

        public javax.tools.FileObject getResource​(javax.tools.JavaFileManager.Location location,
                                                  java.lang.CharSequence pkg,
                                                  java.lang.CharSequence relativeName)
                                           throws java.io.IOException
        Specified by:
        getResource in interface javax.annotation.processing.Filer
        Throws:
        java.io.IOException