Class BeanDefinitionWriter

java.lang.Object
io.micronaut.inject.writer.AbstractClassFileWriter
io.micronaut.inject.writer.BeanDefinitionWriter
All Implemented Interfaces:
AnnotatedElement, AnnotationMetadata, AnnotationMetadataDelegate, AnnotationMetadataProvider, AnnotationSource, Described, Named, Toggleable, MutableAnnotationMetadataDelegate<Element>, BeanElement, Element, BeanDefinitionVisitor, ClassOutputWriter, OriginatingElements, org.objectweb.asm.Opcodes

@Internal public class BeanDefinitionWriter extends AbstractClassFileWriter implements BeanDefinitionVisitor, BeanElement, Toggleable

Responsible for building BeanDefinition instances at compile time. Uses ASM build the class definition.

Should be used from AST frameworks to build bean definitions from source code data.

For example:

     

          BeanDefinitionWriter writer = new BeanDefinitionWriter("my.package", "MyClass", "jakarta.inject.Singleton", true)
          writer.visitBeanDefinitionConstructor()
          writer.visitFieldInjectionPoint("my.Qualifier", false, "my.package.MyDependency", "myfield" )
          writer.visitBeanDefinitionEnd()
          writer.writeTo(new File(..))
     
 
Since:
1.0
Author:
Graeme Rocher, Denis Stepanov
See Also: