@AutoService(value=javax.annotation.processing.Processor.class)
public final class GlideAnnotationProcessor
extends javax.annotation.processing.AbstractProcessor
This processor discovers all AppGlideModule and LibraryGlideModule
implementations that are annotated with GlideModule. Any
implementations missing the annotation will be ignored.
This processor also discovers all GlideExtension
annotated classes.
Multiple classes are generated by this processor:
LibraryGlideModules - A GlideIndexer class in a specific package that will
later be used by the processor to discover all LibraryGlideModule classes.
AppGlideModules - A single AppGlideModule implementation (com.bumptech.glide.GeneratedAppGlideModule) that calls all LibraryGlideModules and
the original AppGlideModule in the correct order when Glide is initialized.
GlideExtensions -
com.bumptech.glide.request.RequestOptions implementation that contains
static versions of all builder methods in the base class and both static and instance
versions of methods in all GlideExtensions.
GlideExtension annotated classes are annotated with
GlideType:
com.bumptech.glide.RequestManager implementation containing a
generated method for each method annotated with GlideType.
com.bumptech.glide.manager.RequestManagerRetriever.RequestManagerFactory
implementation that produces the generated com.bumptech.glide.RequestManagers.
com.bumptech.glide.Glide look-alike that implements all static
methods in the com.bumptech.glide.Glide singleton and returns the
generated com.bumptech.glide.RequestManager implementation when
appropriate.
AppGlideModule implementations must only be included in applications, not in
libraries. There must be exactly one AppGlideModule implementation per Application. The
AppGlideModule class is used as a signal that all modules have been found and that the
final merged com.bumptech.glide.GeneratedAppGlideModule impl can be created.
| Constructor and Description |
|---|
GlideAnnotationProcessor() |
| Modifier and Type | Method and Description |
|---|---|
java.util.Set<java.lang.String> |
getSupportedAnnotationTypes() |
javax.lang.model.SourceVersion |
getSupportedSourceVersion() |
void |
init(javax.annotation.processing.ProcessingEnvironment processingEnvironment) |
boolean |
process(java.util.Set<? extends javax.lang.model.element.TypeElement> set,
javax.annotation.processing.RoundEnvironment env)
Each round we do the following:
Find all
AppGlideModules and save them to an instance variable (throw if > 1). |
public void init(javax.annotation.processing.ProcessingEnvironment processingEnvironment)
init in interface javax.annotation.processing.Processorinit in class javax.annotation.processing.AbstractProcessorpublic java.util.Set<java.lang.String> getSupportedAnnotationTypes()
getSupportedAnnotationTypes in interface javax.annotation.processing.ProcessorgetSupportedAnnotationTypes in class javax.annotation.processing.AbstractProcessorpublic javax.lang.model.SourceVersion getSupportedSourceVersion()
getSupportedSourceVersion in interface javax.annotation.processing.ProcessorgetSupportedSourceVersion in class javax.annotation.processing.AbstractProcessorpublic boolean process(java.util.Set<? extends javax.lang.model.element.TypeElement> set,
javax.annotation.processing.RoundEnvironment env)
AppGlideModules and save them to an instance variable (throw if > 1).
LibraryGlideModules
LibraryGlideModule, write an Indexer with an Annotation with the
class name.
Indexers, return and wait for the next round.
Indexers and there is a AppGlideModule, write the
GeneratedAppGlideModule. Once the GeneratedAppGlideModule is written, we
expect to be finished. Any further generation of related classes will result in errors.
process in interface javax.annotation.processing.Processorprocess in class javax.annotation.processing.AbstractProcessor