Class DirectoryClassWriterOutputVisitor
java.lang.Object
io.micronaut.inject.writer.AbstractClassWriterOutputVisitor
io.micronaut.inject.writer.DirectoryClassWriterOutputVisitor
- All Implemented Interfaces:
ClassWriterOutputVisitor
A
ClassWriterOutputVisitor that writes to a target directory.- Since:
- 1.0
- Author:
- graemerocher
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvisitClass(String classname, @Nullable Element originatingElement) Visits a new class and returns the output stream with which should be written the bytes of the class to be generated.visitClass(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.visitGeneratedFile(String path) Visit a file that will be generated within the generated 'sources' directory.visitGeneratedFile(String path, Element... originatingElements) Visit a file that will be generated within the generated 'sources' directory.visitMetaInfFile(String path, Element... originatingElements) Visit a file within the META-INF directory of the 'classes' directory.voidvisitServiceDescriptor(String type, String classname, Element originatingElement) Allows adding a class that will be written to theMETA-INF/servicesfile under the given type and class name.Methods inherited from class AbstractClassWriterOutputVisitor
finish, getServiceEntries, visitServiceDescriptor, writeServiceEntriesMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ClassWriterOutputVisitor
visitClass, visitGeneratedSourceFile, visitMetaInfFile, visitServiceDescriptor, visitServiceDescriptor
-
Constructor Details
-
DirectoryClassWriterOutputVisitor
- Parameters:
targetDir- The target directory
-
-
Method Details
-
visitClass
public OutputStream visitClass(String classname, @Nullable Element originatingElement) throws IOException Description copied from interface:ClassWriterOutputVisitorVisits 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:
IOException- if an error occurs creating the output stream
-
visitClass
Description copied from interface:ClassWriterOutputVisitorVisits 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.AGGREGATINGvisitor 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:
IOException- if an error occurs creating the output stream
-
visitServiceDescriptor
Description copied from interface:ClassWriterOutputVisitorAllows adding a class that will be written to theMETA-INF/servicesfile under the given type and class name.- Parameters:
type- the fully qualified service nameclassname- the fully qualified classnameoriginatingElement- The originating element
-
visitMetaInfFile
Description copied from interface:ClassWriterOutputVisitorVisit 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
Description copied from interface:ClassWriterOutputVisitorVisit 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
Description copied from interface:ClassWriterOutputVisitorVisit a file that will be generated within the generated 'sources' directory.- Parameters:
path- The pathoriginatingElements- the originating elements- Returns:
- The file if it was possible to create it
-