@Internal public class JavaVisitorContext extends Object implements VisitorContext, BeanElementVisitorContext
MICRONAUT_BASE_OPTION_NAME, MICRONAUT_PROCESSING_GROUP, MICRONAUT_PROCESSING_MODULE, MICRONAUT_PROCESSING_PROJECT_DIREMPTY| Constructor and Description | 
|---|
JavaVisitorContext(ProcessingEnvironment processingEnv,
                  Messager messager,
                  Elements elements,
                  AnnotationUtils annotationUtils,
                  Types types,
                  ModelUtils modelUtils,
                  GenericUtils genericUtils,
                  Filer filer,
                  MutableConvertibleValues<Object> visitorAttributes,
                  TypeElementVisitor.VisitorKind visitorKind)
The default constructor. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
BeanElementBuilder | 
addAssociatedBean(Element originatingElement,
                 ClassElement type)  | 
void | 
addGeneratedResource(String resource)
Some TypeElementVisitors generate classpath resources that other visitors might be interested in. 
 | 
MutableConvertibleValues<Object> | 
clear()
Clear all values. 
 | 
void | 
fail(String message,
    Element element)
Allows failing compilation for a given element with the given message. 
 | 
void | 
finish()
Finish writing and flush any service entries to disk. 
 | 
<T> Optional<T> | 
get(CharSequence name,
   ArgumentConversionContext<T> conversionContext)
Resolve the given property for the given name. 
 | 
AnnotationUtils | 
getAnnotationUtils()
The annotation utils. 
 | 
List<AbstractBeanDefinitionBuilder> | 
getBeanElementBuilders()  | 
Optional<ClassElement> | 
getClassElement(String name)
This method will lookup another class element by name. 
 | 
ClassElement[] | 
getClassElements(String aPackage,
                String... stereotypes)
Find all the classes within the given package and having the given annotation. 
 | 
Iterable<URL> | 
getClasspathResources(String path)
Obtain a set of resources from the user classpath. 
 | 
JavaElementFactory | 
getElementFactory()
Gets the element factory for this visitor context. 
 | 
Elements | 
getElements()
The elements. 
 | 
Collection<String> | 
getGeneratedResources()
Provide a collection of generated classpath resources that other TypeElement visitors might want to consume. 
 | 
GenericUtils | 
getGenericUtils()
The generic utils object. 
 | 
Messager | 
getMessager()
The messager. 
 | 
ModelUtils | 
getModelUtils()
The model utils. 
 | 
Map<String,String> | 
getOptions()
Java visitor context options from  
javac arguments and System.getProperties() | 
ProcessingEnvironment | 
getProcessingEnv()  | 
Types | 
getTypes()
The types. 
 | 
TypeElementVisitor.VisitorKind | 
getVisitorKind()  | 
void | 
info(String message)
Allows printing informational messages. 
 | 
void | 
info(String message,
    Element element)
Allows printing informational messages. 
 | 
Set<String> | 
names()  | 
MutableConvertibleValues<Object> | 
put(CharSequence key,
   Object value)
Insert a value for the given key and value. 
 | 
MutableConvertibleValues<Object> | 
remove(CharSequence key)
Remove a value for the given key. 
 | 
Collection<Object> | 
values()  | 
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. 
 | 
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 located within the generated source directory. 
 | 
Optional<GeneratedFile> | 
visitMetaInfFile(String path,
                Element... originatingElements)
Visit a file within the META-INF directory. 
 | 
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. | 
void | 
warn(String message,
    Element element)
Allows printing a warning for the given message and element. 
 | 
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetClassElement, getClassesOutputPath, getConfiguration, getProjectDir, visitMetaInfFileof, putAll, putAllasMap, asMap, asProperties, contains, empty, forEach, getValue, getValueType, isEmpty, iterator, subMap, subMap, subMapget, get, getforEach, spliteratorgetServiceEntries, visitClass, visitServiceDescriptorpublic JavaVisitorContext(ProcessingEnvironment processingEnv, Messager messager, Elements elements, AnnotationUtils annotationUtils, Types types, ModelUtils modelUtils, GenericUtils genericUtils, Filer filer, MutableConvertibleValues<Object> visitorAttributes, TypeElementVisitor.VisitorKind visitorKind)
processingEnv - The processing environmentmessager - The messagerelements - The elementsannotationUtils - The annotation utilstypes - Type typesmodelUtils - The model utilsgenericUtils - The generic type utilsfiler - The filervisitorAttributes - The attributesvisitorKind - The visitor kindpublic TypeElementVisitor.VisitorKind getVisitorKind()
public ProcessingEnvironment getProcessingEnv()
@NonNull public Iterable<URL> getClasspathResources(@NonNull String path)
VisitorContextgetClasspathResources in interface VisitorContextpath - The pathpublic Optional<ClassElement> getClassElement(String name)
VisitorContextgetClassElement in interface VisitorContextname - The name@NonNull public ClassElement[] getClassElements(@NonNull String aPackage, @NonNull String... stereotypes)
VisitorContextgetClassElements in interface VisitorContextaPackage - The packagestereotypes - The stereotypes@NonNull public JavaElementFactory getElementFactory()
VisitorContextgetElementFactory in interface VisitorContextpublic void info(String message, @Nullable Element element)
VisitorContextinfo in interface VisitorContextmessage - The messageelement - The elementpublic void info(String message)
VisitorContextinfo in interface VisitorContextmessage - The messagepublic void fail(String message, @Nullable Element element)
VisitorContextfail in interface VisitorContextmessage - The messageelement - The elementpublic void warn(String message, @Nullable Element element)
VisitorContextwarn in interface VisitorContextmessage - The messageelement - The elementpublic OutputStream visitClass(String classname, @Nullable Element originatingElement) throws IOException
ClassWriterOutputVisitorvisitClass in interface ClassWriterOutputVisitorclassname - the fully qualified classnameoriginatingElement - The originating elementIOException - if an error occurs creating the output streampublic OutputStream visitClass(String classname, Element... originatingElements) throws IOException
ClassWriterOutputVisitor
 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
visitClass in interface ClassWriterOutputVisitorclassname - the fully qualified classnameoriginatingElements - The originating elementsIOException - if an error occurs creating the output streampublic void visitServiceDescriptor(String type, String classname)
ClassWriterOutputVisitorMETA-INF/services file under the given type and class
 name.visitServiceDescriptor in interface ClassWriterOutputVisitortype - the fully qualified service nameclassname - the fully qualified classnamepublic Optional<GeneratedFile> visitMetaInfFile(String path, Element... originatingElements)
VisitorContextvisitMetaInfFile in interface VisitorContextvisitMetaInfFile in interface ClassWriterOutputVisitorpath - The path to the fileoriginatingElements - The originating elementspublic Optional<GeneratedFile> visitGeneratedFile(String path)
VisitorContextvisitGeneratedFile in interface VisitorContextvisitGeneratedFile in interface ClassWriterOutputVisitorpath - The path to the filepublic void finish()
ClassWriterOutputVisitorfinish in interface ClassWriterOutputVisitorpublic Messager getMessager()
public ModelUtils getModelUtils()
public Elements getElements()
public AnnotationUtils getAnnotationUtils()
public Types getTypes()
public GenericUtils getGenericUtils()
public Map<String,String> getOptions()
javac arguments and System.getProperties()
 System properties has priority over arguments.
getOptions in interface VisitorContextTypeElementVisitor, 
javac argumentspublic MutableConvertibleValues<Object> put(CharSequence key, @Nullable Object value)
MutableConvertibleValuesput in interface MutableConvertibleValues<Object>key - The keyvalue - The valuepublic MutableConvertibleValues<Object> remove(CharSequence key)
MutableConvertibleValuesremove in interface MutableConvertibleValues<Object>key - The keypublic MutableConvertibleValues<Object> clear()
MutableConvertibleValuesclear in interface MutableConvertibleValues<Object>public Set<String> names()
names in interface ConvertibleValues<Object>public Collection<Object> values()
values in interface ConvertibleValues<Object>public <T> Optional<T> get(CharSequence name, ArgumentConversionContext<T> conversionContext)
ValueResolverget in interface ValueResolver<CharSequence>T - The concrete typename - The nameconversionContext - The conversion contextpublic Collection<String> getGeneratedResources()
VisitorContextgetGeneratedResources in interface VisitorContextpublic void addGeneratedResource(@NonNull String resource)
VisitorContextaddGeneratedResource in interface VisitorContextresource - the relative path to add@Internal public List<AbstractBeanDefinitionBuilder> getBeanElementBuilders()
public BeanElementBuilder addAssociatedBean(Element originatingElement, ClassElement type)
addAssociatedBean in interface BeanElementVisitorContext