Package io.micronaut.openapi.generator
Interface MicronautCodeGeneratorBuilder
public interface MicronautCodeGeneratorBuilder
A code generator builder.
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Returns a configured code generator.<B extends GeneratorOptionsBuilder,G extends MicronautCodeGenerator<B>>
MicronautCodeGeneratorBuilderforCodeGenerator(G generator, Consumer<? super B> configuration) Sets the code generator which should be used (e.g.default MicronautCodeGeneratorBuilderConfigures the code generator to create a java client.forJavaClient(Consumer<? super JavaMicronautClientOptionsBuilder> clientOptionsSpec) Configures the code generator to create a java client.default MicronautCodeGeneratorBuilderConfigures the code generator to create a java server.forJavaServer(Consumer<? super JavaMicronautServerOptionsBuilder> serverOptionsSpec) Configures the code generator to create a java server.default MicronautCodeGeneratorBuilderConfigures the code generator to create a kotlin client.forKotlinClient(Consumer<? super KotlinMicronautClientOptionsBuilder> clientOptionsSpec) Configures the code generator to create a kotlin client.default MicronautCodeGeneratorBuilderConfigures the code generator to create a kotlin server.forKotlinServer(Consumer<? super KotlinMicronautServerOptionsBuilder> serverOptionsSpec) Configures the code generator to create a kotlin server.withDefinitionFile(URI definitionFile) Sets the URI to the OpenAPI definition file.withOptions(Consumer<? super MicronautCodeGeneratorOptionsBuilder> optionsConfigurer) Configures the code generation options.withOutputDirectory(File outputDirectory) Sets the directory where to output the generated sources.withOutputs(MicronautCodeGeneratorEntryPoint.OutputKind... elements) Sets which output files should be generated.
-
Method Details
-
forCodeGenerator
<B extends GeneratorOptionsBuilder,G extends MicronautCodeGenerator<B>> MicronautCodeGeneratorBuilder forCodeGenerator(G generator, Consumer<? super B> configuration) Sets the code generator which should be used (e.g. server or client).- Type Parameters:
B- the type of the builder used to configure the options specific to this generatorG- the type of the generator- Parameters:
generator- the generatorconfiguration- the configuration block for this generator- Returns:
- this builder
-
forJavaClient
Configures the code generator to create a java client.- Returns:
- this builder
-
forJavaClient
MicronautCodeGeneratorBuilder forJavaClient(Consumer<? super JavaMicronautClientOptionsBuilder> clientOptionsSpec) Configures the code generator to create a java client.- Parameters:
clientOptionsSpec- the client options- Returns:
- this builder
-
forJavaServer
Configures the code generator to create a java server.- Returns:
- this builder
-
forJavaServer
MicronautCodeGeneratorBuilder forJavaServer(Consumer<? super JavaMicronautServerOptionsBuilder> serverOptionsSpec) Configures the code generator to create a java server.- Parameters:
serverOptionsSpec- the server options- Returns:
- this builder
-
forKotlinClient
Configures the code generator to create a kotlin client.- Returns:
- this builder
-
forKotlinClient
MicronautCodeGeneratorBuilder forKotlinClient(Consumer<? super KotlinMicronautClientOptionsBuilder> clientOptionsSpec) Configures the code generator to create a kotlin client.- Parameters:
clientOptionsSpec- the client options- Returns:
- this builder
-
forKotlinServer
Configures the code generator to create a kotlin server.- Returns:
- this builder
-
forKotlinServer
MicronautCodeGeneratorBuilder forKotlinServer(Consumer<? super KotlinMicronautServerOptionsBuilder> serverOptionsSpec) Configures the code generator to create a kotlin server.- Parameters:
serverOptionsSpec- the server options- Returns:
- this builder
-
withDefinitionFile
Sets the URI to the OpenAPI definition file. It is recommended to use a local path instead of using a remote URI.- Parameters:
definitionFile- the definition file- Returns:
- this builder
-
withOutputDirectory
Sets the directory where to output the generated sources.- Parameters:
outputDirectory- the generated sources output directory- Returns:
- this builder
-
withOutputs
Sets which output files should be generated.- Parameters:
elements- the different elements to generate- Returns:
- this builder
-
withOptions
MicronautCodeGeneratorBuilder withOptions(Consumer<? super MicronautCodeGeneratorOptionsBuilder> optionsConfigurer) Configures the code generation options.- Parameters:
optionsConfigurer- the configuration- Returns:
- this builder
-
build
MicronautCodeGeneratorEntryPoint build()Returns a configured code generator.- Returns:
- the configured code generator
-