Interface GeneratedImportsModifier


  • public interface GeneratedImportsModifier
    Ad-hoc tool to change imports in generated source files after imports have been processed. The annotation processor with load implementations of this interface using classpath service loading, see ServiceLoader for the details. Make sure it will be present of the annotation processor classpath rather than compile classpath if they are not the same in your build tool. Implementations should take special care of safety, i.e. they should neither throw exception during construction or processing nor leave set of imports in an improperly modified state.
    Since:
    2.1
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void modify​(java.lang.String packageOfGeneratedFile, java.util.Set<java.lang.String> imports)
      Modify imports set after import processing/extraction but before writing generated files.
    • Method Detail

      • modify

        void modify​(java.lang.String packageOfGeneratedFile,
                    java.util.Set<java.lang.String> imports)
        Modify imports set after import processing/extraction but before writing generated files. Important to note that there are no way to change classnames as other parts of source file refers to class by simple name. However package-name part of imports may be rewritten.
        Parameters:
        packageOfGeneratedFile - informative package name of the generated file, may be used to employ different strategies for different packages.
        imports - modifiables set of imports