Package io.micronaut.inject.writer
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
AClassWriterOutputVisitor
that writes to a target target directory.- Since:
- 1.0
-
-
Constructor Summary
Constructors Constructor Description DirectoryClassWriterOutputVisitor(java.io.File targetDir)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.io.OutputStream
visitClass(java.lang.String classname, Element originatingElement)
Visits a new class and returns the output stream with which should be written the bytes of the class to be generated.java.io.OutputStream
visitClass(java.lang.String classname, Element... originatingElements)
Visits a new class and returns the output stream with which should be written the bytes of the class to be generated.java.util.Optional<GeneratedFile>
visitGeneratedFile(java.lang.String path)
Visit a file that will be generated within the generated sources directory.java.util.Optional<GeneratedFile>
visitMetaInfFile(java.lang.String path, Element... originatingElements)
Visit a file within the META-INF directory of the classes directory.void
visitServiceDescriptor(java.lang.String type, java.lang.String classname, Element originatingElement)
Allows adding a class that will be written to theMETA-INF/services
file under the given type and class name.-
Methods inherited from class io.micronaut.inject.writer.AbstractClassWriterOutputVisitor
finish, getServiceEntries, visitServiceDescriptor, writeServiceEntries
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.micronaut.inject.writer.ClassWriterOutputVisitor
visitClass, visitMetaInfFile, visitServiceDescriptor, visitServiceDescriptor
-
-
-
-
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 classnameoriginatingElement
- 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 theTypeElementVisitor.finish(io.micronaut.inject.visitor.VisitorContext)
method. If the file- Parameters:
classname
- the fully qualified classnameoriginatingElements
- 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 theMETA-INF/services
file under the given type and class name.- Parameters:
type
- the fully qualified service nameclassname
- the fully qualified classnameoriginatingElement
- 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 fileoriginatingElements
- 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
-
-