Class InjectionAnnotationProcessor

java.lang.Object
javax.annotation.processing.AbstractProcessor
io.helidon.inject.processor.InjectionAnnotationProcessor
All Implemented Interfaces:
Processor
Direct Known Subclasses:
ConfigDrivenProcessor

public class InjectionAnnotationProcessor extends AbstractProcessor
An annotation processor that will find everything needing to be processed related to core code generation.
  • Constructor Details

    • InjectionAnnotationProcessor

      @Deprecated public InjectionAnnotationProcessor()
      Deprecated.
      this is a Java ServiceLoader implementation and the constructor should not be used directly
      Service loader based constructor.
    • InjectionAnnotationProcessor

      protected InjectionAnnotationProcessor(boolean disableBaseProcessing)
      Any overriding APT processor can optionally pass false in order to prevent duplicate base processing.
      Parameters:
      disableBaseProcessing - set to true to disable base processing
  • Method Details

    • getSupportedAnnotationTypes

      public Set<String> getSupportedAnnotationTypes()
      Specified by:
      getSupportedAnnotationTypes in interface Processor
    • init

      public void init(ProcessingEnvironment processingEnv)
      Specified by:
      init in interface Processor
    • process

      public final boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv)
      Specified by:
      process in interface Processor
      Specified by:
      process in class AbstractProcessor
    • activatorCreator

      protected ActivatorCreator activatorCreator()
      Returns the activator creator in use.
      Returns:
      the activator creator in use
    • supportedServiceClassTargetAnnotations

      protected Set<String> supportedServiceClassTargetAnnotations()
      The annotation types we handle that will trigger activator creation.
      Returns:
      annotation types we handle on services
    • supportedContractClassTargetAnnotations

      protected Set<String> supportedContractClassTargetAnnotations()
      The annotation types we handle that will be advertised as contracts.
      Returns:
      annotation types we handle on contracts
    • supportedElementTargetAnnotations

      protected Set<String> supportedElementTargetAnnotations()
      The annotation types we expect to see on method and field type elements.
      Returns:
      annotation types we handle on elements
    • doFiler

      protected void doFiler(ServicesToProcess services)
      Code generate these Activator's ad ModuleComponent's.
      Parameters:
      services - the services to code generate
      Throws:
      ToolsException - if there is problem code generating sources or resources
    • validate

      protected void validate(Collection<TypedElementInfo> elementsOfInterest)
      These are all of the elements (methods, constructors, methods) that are "interesting" (i.e., has @Inject, etc.).
      Parameters:
      elementsOfInterest - the elements that are eligible for some form of Injection processing
    • interceptAndValidate

      protected Set<TypeInfo> interceptAndValidate(Collection<TypeInfo> typesToCreateActivatorsFor)
      Provides a means for anyone to validate and intercept the collection of types to process.
      Parameters:
      typesToCreateActivatorsFor - the map of types to process (where key is the proposed generated name)
      Returns:
      the (possibly revised) set of types to process
    • process

      protected void process(ServicesToProcess services, TypeInfo service, Set<TypeName> serviceTypeNamesToCodeGenerate, Collection<TypedElementInfo> allElementsOfInterest)
      Called to process a single service that will eventually be code generated. The default implementation will take the provided service TypeInfo and translate that into the ServicesToProcess instance. Eventually, the ServicesToProcess instance will be fed as request inputs to one or more of the creators (e.g., ActivatorCreator, InterceptorCreator, etc.).
      Parameters:
      services - the services to process builder
      service - the service type info to process right now
      serviceTypeNamesToCodeGenerate - the entire set of types that are planned to be code-generated
      allElementsOfInterest - all of the elements of interest that injection services "knows" about
    • processBasics

      protected void processBasics(ServicesToProcess services, TypeInfo service, Set<TypeName> serviceTypeNamesToCodeGenerate, Collection<TypedElementInfo> allElementsOfInterest)
      Processes the basic Injection service type - its contracts, run level, weight, dependencies, etc.
      Parameters:
      services - the services to process builder
      service - the service type info to process right now
      serviceTypeNamesToCodeGenerate - the entire set of types that are planned to be code-generated
      allElementsOfInterest - all of the elements of interest that injection "knows" about
    • serviceDefiningAnnotations

      protected Set<TypeName> serviceDefiningAnnotations()
      The set of annotations that define the service.
      Returns:
      the set of annotations that define the service
    • processExtensions

      protected void processExtensions(ServicesToProcess services, TypeInfo service, Set<TypeName> serviceTypeNamesToCodeGenerate, Collection<TypedElementInfo> allElementsOfInterest)
      Process any extensions (e.g., config-driven) requiring extra processing or any modifications to ServicesToProcess.
      Parameters:
      services - the services to process builder
      service - the service type info to process right now
      serviceTypeNamesToCodeGenerate - the entire set of types that are planned to be code-generated
      allElementsOfInterest - all of the elements of interest that injection "knows" about
    • getSupportedSourceVersion

      public SourceVersion getSupportedSourceVersion()
      Specified by:
      getSupportedSourceVersion in interface Processor
      Overrides:
      getSupportedSourceVersion in class AbstractProcessor