Class DirectoryClassWriterOutputVisitor

    • Constructor Detail

      • DirectoryClassWriterOutputVisitor

        public DirectoryClassWriterOutputVisitor​(java.io.File targetDir)
        Parameters:
        targetDir - The target directory
    • Method Detail

      • visitClass

        public java.io.OutputStream visitClass​(java.lang.String classname,
                                               @Nullable
                                               Element originatingElement)
                                        throws java.io.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:
        java.io.IOException - if an error occurs creating the output stream
      • visitClass

        public java.io.OutputStream visitClass​(java.lang.String classname,
                                               Element... originatingElements)
                                        throws java.io.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:
        java.io.IOException - if an error occurs creating the output stream
      • visitServiceDescriptor

        public void visitServiceDescriptor​(java.lang.String type,
                                           java.lang.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 java.util.Optional<GeneratedFile> visitMetaInfFile​(java.lang.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 java.util.Optional<GeneratedFile> visitGeneratedFile​(java.lang.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