Class AnnotationProcessingOutputVisitor
java.lang.Object
io.micronaut.inject.writer.AbstractClassWriterOutputVisitor
io.micronaut.annotation.processing.AnnotationProcessingOutputVisitor
- All Implemented Interfaces:
ClassWriterOutputVisitor
An implementation of
ClassWriterOutputVisitor
for annotation processing.- Since:
- 1.0
- Author:
- Graeme Rocher
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvisitClass
(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.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.visitGeneratedSourceFile
(String packageName, String fileNameWithoutExtension, Element... originatingElements) Visit a source 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.void
visitServiceDescriptor
(String type, 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
-
Constructor Details
-
AnnotationProcessingOutputVisitor
- Parameters:
filer
- TheFiler
for creating new files
-
-
Method Details
-
visitClass
public OutputStream visitClass(String classname, @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 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: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:
IOException
- if an error occurs creating the output stream
-
visitServiceDescriptor
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
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
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
Description copied from interface:ClassWriterOutputVisitor
Visit 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
-
visitGeneratedSourceFile
public Optional<GeneratedFile> visitGeneratedSourceFile(String packageName, String fileNameWithoutExtension, Element... originatingElements) Description copied from interface:ClassWriterOutputVisitor
Visit a source file that will be generated within the generated 'sources' directory.- Parameters:
packageName
- The package for the source filefileNameWithoutExtension
- the name of the source file, without extension (determined automatically)originatingElements
- the originating elements- Returns:
- The file if it was possible to create it
-