Interface CodeGenProvider


public interface CodeGenProvider
Service providers for this interface are triggered during generate-sources phase of build of Quarkus applications
  • Method Summary

    Modifier and Type
    Method
    Description
    default Path
    Provides the possibility for the provider to override the default input directory.
    default void
    init(io.quarkus.bootstrap.model.ApplicationModel model, Map<String,String> properties)
    Provides the possibility for the provider to initialize itself using the application model and properties.
    Name of the directory containing input files for a given CodeGenProvider implementation relative to a sources root directory.
    default String
    Deprecated.
    default String[]
    File extensions that CodeGenProvider will generate code from
     
    static Path
    resolve(Path path)
    Resolve path; e.g.
    default boolean
    shouldRun(Path sourceDir, org.eclipse.microprofile.config.Config config)
     
    boolean
    Trigger code generation
  • Method Details

    • providerId

      @NotNull String providerId()
      Returns:
      unique name of the code gen provider, will correspond to the directory in generated-sources
    • inputExtension

      @Deprecated default String inputExtension()
      Deprecated.
      File extension that CodeGenProvider will generate code from Deprecated: use inputExtensions instead
      Returns:
      file extension
    • inputExtensions

      @NotNull default String[] inputExtensions()
      File extensions that CodeGenProvider will generate code from
      Returns:
      file extensions
    • inputDirectory

      @NotNull String inputDirectory()
      Name of the directory containing input files for a given CodeGenProvider implementation relative to a sources root directory. For example, if an input directory is configured as foo, for a production build of an application the sources will be looked up at src/main/foo path and at src/test/foo for tests.
      Returns:
      the input directory
    • getInputDirectory

      default Path getInputDirectory()
      Provides the possibility for the provider to override the default input directory. This method is called after init(ApplicationModel, Map). Returning null will result in the inputDirectory method being called to retrieve the default input directory.

      The returned path must be an absolute path. However, pointing to a directory outside of the project structure should be avoided for security purposes.

      Returns:
      the input directory, must be an absolute path. null would result in the default input directory being used.
    • init

      default void init(io.quarkus.bootstrap.model.ApplicationModel model, Map<String,String> properties)
      Provides the possibility for the provider to initialize itself using the application model and properties.
      Parameters:
      model - the application model
      properties - the build time properties defined in the application build file (pom.xml or gradle.build)
    • trigger

      boolean trigger(CodeGenContext context) throws CodeGenException
      Trigger code generation
      Parameters:
      context - code generation context
      Returns:
      true if files were generated/modified
      Throws:
      CodeGenException
    • shouldRun

      default boolean shouldRun(Path sourceDir, org.eclipse.microprofile.config.Config config)
    • resolve

      static Path resolve(Path path)
      Resolve path; e.g. symlinks, etc
      Parameters:
      path - the path to resolve
      Returns:
      resolved path