Interface CodegenContext

All Known Subinterfaces:
AptContext, ScanContext
All Known Implementing Classes:
CodegenContextBase, CodegenContextDelegate

public interface CodegenContext
Code processing and generation context.
  • Method Details

    • module

      Optional<ModuleInfo> module()
      Module that is being processed.
      Returns:
      module info if defined, for modules without module-info.java returns empty optional
    • moduleName

      default Optional<String> moduleName()
      Configured module name using CodegenOptions.CODEGEN_MODULE, or name of the module if defined from module(), or empty if not identified.
      Returns:
      name of the module
    • filer

      CodegenFiler filer()
      Filer to generate sources and resources.
      Returns:
      a filer abstraction
    • logger

      CodegenLogger logger()
      Logger to log messages according to the environment we run in (Annotation processor, Maven plugin, command line).
      Returns:
      a logger abstraction
    • scope

      CodegenScope scope()
      Current code generation scope. Usually guessed from the environment, can be overridden using CodegenOptions.CODEGEN_SCOPE
      Returns:
      scope
    • options

      CodegenOptions options()
      Code generation options.
      Returns:
      options of the current environment
    • typeInfo

      Optional<TypeInfo> typeInfo(TypeName typeName)
      Discover information about the provided type.
      Parameters:
      typeName - type name to discover
      Returns:
      discovered type information, or empty if the type cannot be discovered
    • typeInfo

      Optional<TypeInfo> typeInfo(TypeName typeName, Predicate<TypedElementInfo> elementPredicate)
      Discover information about the provided type, with a predicate for child elements.
      Parameters:
      typeName - type name to discover
      elementPredicate - predicate for child elements
      Returns:
      discovered type information, or empty if the type cannot be discovered
    • elementMappers

      List<ElementMapper> elementMappers()
      List of available element mappers in this environment. Used for example when discovering typeInfo(io.helidon.common.types.TypeName).
      Returns:
      list of mapper
    • typeMappers

      List<TypeMapper> typeMappers()
      List of available type mappers in this environment. Used for example when discovering typeInfo(io.helidon.common.types.TypeName).
      Returns:
      list of mapper
    • annotationMappers

      List<AnnotationMapper> annotationMappers()
      List of available annotation mappers in this environment. Used for example when discovering typeInfo(io.helidon.common.types.TypeName).
      Returns:
      list of mapper
    • mapperSupportedAnnotations

      Set<TypeName> mapperSupportedAnnotations()
      Annotations supported by the mappers. This is augmented by the annotations supported by all extensions and used to discover types.
      Returns:
      set of annotation types supported by the mapper
    • mapperSupportedAnnotationPackages

      Set<String> mapperSupportedAnnotationPackages()
      Annotation packages supported by the mappers. This is augmented by the annotation packages supported by all extensions and used to discover types.
      Returns:
      set of annotation packages
    • supportedOptions

      Set<Option<?>> supportedOptions()
      Codegen options supported by the mappers. This is augmented by the options supported by all extensions.
      Returns:
      set of supported options