Class DirectoryClassWriterOutputVisitor

java.lang.Object
io.micronaut.inject.writer.AbstractClassWriterOutputVisitor
io.micronaut.inject.writer.DirectoryClassWriterOutputVisitor
All Implemented Interfaces:
ClassWriterOutputVisitor

@Internal public class DirectoryClassWriterOutputVisitor extends AbstractClassWriterOutputVisitor
A ClassWriterOutputVisitor that writes to a target directory.
Since:
1.0
Author:
graemerocher
  • Constructor Details

    • DirectoryClassWriterOutputVisitor

      public DirectoryClassWriterOutputVisitor(File targetDir)
      Parameters:
      targetDir - The target directory
  • Method Details

    • visitClass

      public OutputStream visitClass(String classname, @Nullable @Nullable Element originatingElement) throws IOException
      Description copied from interface: ClassWriterOutputVisitor
      Visits a new class and returns the output stream with which should be written the bytes of the class to be generated.
      Parameters:
      classname - the fully qualified classname
      originatingElement - The originating element
      Returns:
      the output stream to write to
      Throws:
      IOException - if an error occurs creating the output stream
    • visitClass

      public OutputStream visitClass(String classname, Element... originatingElements) throws IOException
      Description copied from interface: ClassWriterOutputVisitor
      Visits a new class and returns the output stream with which should be written the bytes of the class to be generated.

      Note that this method should only be called from a TypeElementVisitor.VisitorKind.AGGREGATING visitor from within the TypeElementVisitor.finish(io.micronaut.inject.visitor.VisitorContext) method. If the file

      Parameters:
      classname - the fully qualified classname
      originatingElements - The originating elements
      Returns:
      the output stream to write to
      Throws:
      IOException - if an error occurs creating the output stream
    • visitServiceDescriptor

      public void visitServiceDescriptor(String type, String classname, Element originatingElement)
      Description copied from interface: ClassWriterOutputVisitor
      Allows adding a class that will be written to the META-INF/services file under the given type and class name.
      Parameters:
      type - the fully qualified service name
      classname - the fully qualified classname
      originatingElement - The originating element
    • visitMetaInfFile

      public Optional<GeneratedFile> visitMetaInfFile(String path, Element... originatingElements)
      Description copied from interface: ClassWriterOutputVisitor
      Visit a file within the META-INF directory of the 'classes' directory.
      Parameters:
      path - The path to the file
      originatingElements - The originating elements
      Returns:
      An optional file it was possible to create it
    • visitGeneratedFile

      public Optional<GeneratedFile> visitGeneratedFile(String path)
      Description copied from interface: ClassWriterOutputVisitor
      Visit a file that will be generated within the generated 'sources' directory.
      Parameters:
      path - The path
      Returns:
      The file if it was possible to create it
    • visitGeneratedFile

      public Optional<GeneratedFile> visitGeneratedFile(String path, Element... originatingElements)
      Description copied from interface: ClassWriterOutputVisitor
      Visit a file that will be generated within the generated 'sources' directory.
      Parameters:
      path - The path
      originatingElements - the originating elements
      Returns:
      The file if it was possible to create it