public interface ClassWriterOutputVisitor
| Modifier and Type | Method and Description |
|---|---|
void |
finish()
Finish writing and flush any service entries to disk.
|
default Map<String,Set<String>> |
getServiceEntries()
The META-INF/services entries to write.
|
default OutputStream |
visitClass(String classname)
Visits a new class and returns the output stream with which should be written the bytes of the class to be
generated.
|
OutputStream |
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.
|
default OutputStream |
visitClass(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.
|
Optional<GeneratedFile> |
visitGeneratedFile(String path)
Visit a file that will be generated within the generated sources directory.
|
default Optional<GeneratedFile> |
visitMetaInfFile(String path)
Deprecated.
Visiting a file should supply the originating elements. Use
visitMetaInfFile(String, Element...) instead |
Optional<GeneratedFile> |
visitMetaInfFile(String path,
Element... originatingElements)
Visit a file within the META-INF directory of the classes directory.
|
default void |
visitServiceDescriptor(Class type,
String classname)
Allows adding a class that will be written to the
META-INF/services file under the given type and class
name. |
void |
visitServiceDescriptor(String type,
String classname)
Allows adding a class that will be written to the
META-INF/services file under the given type and class
name. |
default OutputStream visitClass(String classname) throws IOException
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
classname - the fully qualified classnameIOException - if an error occurs creating the output streamdefault OutputStream visitClass(String classname, @Nullable Element originatingElement) throws IOException
classname - the fully qualified classnameoriginatingElement - The originating elementIOException - if an error occurs creating the output streamOutputStream visitClass(String classname, Element... originatingElements) throws IOException
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
classname - the fully qualified classnameoriginatingElements - The originating elementsIOException - if an error occurs creating the output streamvoid visitServiceDescriptor(String type, String classname)
META-INF/services file under the given type and class
name.type - the fully qualified service nameclassname - the fully qualified classnameIOException - If the file couldn't be created@Deprecated default Optional<GeneratedFile> visitMetaInfFile(String path)
visitMetaInfFile(String, Element...) insteadpath - The path to the fileIOException - If the file couldn't be createdOptional<GeneratedFile> visitMetaInfFile(String path, Element... originatingElements)
path - The path to the fileoriginatingElements - The originating elementsIOException - If the file couldn't be createdOptional<GeneratedFile> visitGeneratedFile(String path)
path - The pathvoid finish()
default Map<String,Set<String>> getServiceEntries()
default void visitServiceDescriptor(Class type, String classname)
META-INF/services file under the given type and class
name.type - The service typeclassname - the fully qualified classnameIOException - If the file couldn't be created