Class CodeGenContext


  • public class CodeGenContext
    extends Object
    Code generation context
    • Constructor Detail

      • CodeGenContext

        public CodeGenContext​(io.quarkus.bootstrap.model.ApplicationModel model,
                              Path outDir,
                              Path workDir,
                              Path inputDir,
                              boolean redirectIO,
                              org.eclipse.microprofile.config.Config config,
                              boolean test)
        Creates a code generation context
        Parameters:
        model - application model
        outDir - target directory for the generated output
        workDir - working directory, typically the main build directory of the project
        inputDir - directory containing input content for a code generator
        redirectIO - whether the code generating process should redirect its IO
        config - application build time configuration
        test - indicates whether the code generation is being triggered for tests
    • Method Detail

      • applicationModel

        public io.quarkus.bootstrap.model.ApplicationModel applicationModel()
        Application model
        Returns:
        application model
      • outDir

        public Path outDir()
        Target directory for the generated output. The directory would typically be resolved as <project.build.directory>/generated-sources/<codegen-provider-id>, where {@code would match the value of {@link CodeGenProvider#providerId()}. For example, for a code gen provider {@code foo}, the output directory in a typical Maven project would be {@code target/generated-sources/foo}.
        Returns:
        target directory for the generated output
      • workDir

        public Path workDir()
        Working directory, typically the main build directory of the project. For a typical Maven project it would be the target directory.
        Returns:
        working directory, typically the main build directory of the project
      • inputDir

        public Path inputDir()
        Directory containing input content for a code generator. For the main application build of a typical Maven project the input sources directory would be <project.basedir>/src/main/<codegen-provider-id>, while for the tests it would be <project.basedir>/src/test/<codegen-provider-id>, where <codegen-provider-id would match the value of CodeGenProvider.providerId().
        Returns:
        directory containing input content a code generator
      • shouldRedirectIO

        public boolean shouldRedirectIO()
        Whether any new processes spawned by a given CodeGenProvider should inherit the launching process' output streams or redirect its output and error streams using ProcessBuilder.Redirect.PIPE. In the current implementation this is typically set to true by the framework.
        Returns:
        whether the code generation process should redirect its error and output streams
      • config

        public org.eclipse.microprofile.config.Config config()
        Application build time configuration
        Returns:
        application build time configuration
      • test

        public boolean test()
        Indicates whether the code generation is being triggered for tests
        Returns:
        indicates whether the code generation is being triggered for tests