Class Codegen
-
- All Implemented Interfaces:
public class CodegenEntrypoint for using Codegen.
Here you add modules and run code generation for them.
-
-
Field Summary
Fields Modifier and Type Field Description private FilebaseDirprivate FileindexFileprivate BooleanforceModeprivate BooleanaddLastGenerationTagprivate BooleanaddLastUpdateTagprivate Charsetcharsetprivate BooleanoverrideWhenDiffsInWhitespacesOnlyprivate StringlineSeparatorprivate final CodegenParamsparamsprivate DataTypeMapperdataTypeMapperprivate final CodeIndexcodeIndex
-
Constructor Summary
Constructors Constructor Description Codegen()
-
Method Summary
Modifier and Type Method Description final FilegetBaseDir()The base/root directory for the generated codes. final UnitsetBaseDir(File baseDir)The base/root directory for the generated codes. final FilegetIndexFile()The location for generated codes index file (if null then: ${baseDir}/generatedFiles.yaml). final UnitsetIndexFile(File indexFile)The location for generated codes index file (if null then: ${baseDir}/generatedFiles.yaml). final BooleangetForceMode()Determines the behavior of the generator when a manual change of generated codes is detected. final UnitsetForceMode(Boolean forceMode)Determines the behavior of the generator when a manual change of generated codes is detected. final BooleangetAddLastGenerationTag()Specifies whether the index of the generated codes should contain the 'lastGeneration' tag with the last generation execution timestamp. final UnitsetAddLastGenerationTag(Boolean addLastGenerationTag)Specifies whether the index of the generated codes should contain the 'lastGeneration' tag with the last generation execution timestamp. final BooleangetAddLastUpdateTag()Specifies whether the entries in the index of generated codes should contain the tag "lastUpdate" with the timestamp of the last change of the generated code. final UnitsetAddLastUpdateTag(Boolean addLastUpdateTag)Specifies whether the entries in the index of generated codes should contain the tag "lastUpdate" with the timestamp of the last change of the generated code. final CharsetgetCharset()The charset for generated codes. final UnitsetCharset(Charset charset)The charset for generated codes. final BooleangetOverrideWhenDiffsInWhitespacesOnly()The file will be overwritten even if the newly generated code differs from the old one only in whitespaces. final UnitsetOverrideWhenDiffsInWhitespacesOnly(Boolean overrideWhenDiffsInWhitespacesOnly)The file will be overwritten even if the newly generated code differs from the old one only in whitespaces. final StringgetLineSeparator()The line separator for generated codes. final UnitsetLineSeparator(String lineSeparator)The line separator for generated codes. final CodegenParamsgetParams()final DataTypeMappergetDataTypeMapper()final UnitsetDataTypeMapper(DataTypeMapper dataTypeMapper)final CodeIndexgetCodeIndex()final Unitrun()Runs code generation. final Unitcleanup()Deletes generated files present in the index file. final UnittotalCleanup()Deletes generated files present in the index file. final <M extends Model, T extends Any, B extends GeneratorBuilder<M, T, B>> Codegengenerate(B generatorBuilder, GeneratorBuilder.Setter<B> setter)Adds module generator to the code generation schedule. final Codegengenerate(Generator<?> generator)Adds module generator to the code generation schedule. final RestApirestApi(String content, RestApi dependencies)final MultipartRestApirestApi(File file, Charset charset)final MultipartRestApirestApi(File file)final WsdlApiwsdlApi(String wsdlLocation, Consumer<WsdlParserConfig> configurator)final CodegenbaseDir(File baseDir)final CodegenindexFile(File indexFile)final CodegenforceMode(Boolean forceMode)final CodegenaddLastGenerationTag(Boolean addLastGenerationTag)final CodegenaddLastUpdateTag(Boolean addLastUpdateTag)final Codegencharset(String charsetName)final CodegenoverrideWhenDiffsInWhitespacesOnly(Boolean overrideWhenDiffsInWhitespacesOnly)final CodegenlineSeparator(String lineSeparator)final CodegendataTypeMapper(Consumer<DataTypeMapper> setter)final Codegenparams(Consumer<CodegenParams> setter)-
-
Method Detail
-
getBaseDir
final File getBaseDir()
The base/root directory for the generated codes.
-
setBaseDir
final Unit setBaseDir(File baseDir)
The base/root directory for the generated codes.
-
getIndexFile
final File getIndexFile()
The location for generated codes index file (if null then: ${baseDir}/generatedFiles.yaml).
-
setIndexFile
final Unit setIndexFile(File indexFile)
The location for generated codes index file (if null then: ${baseDir}/generatedFiles.yaml).
-
getForceMode
final Boolean getForceMode()
Determines the behavior of the generator when a manual change of generated codes is detected.
Note that manually modified codes should have "@Generated" annotation removed.
true - generating will overwrite manual changes (default)
false - generation will fail
-
setForceMode
final Unit setForceMode(Boolean forceMode)
Determines the behavior of the generator when a manual change of generated codes is detected.
Note that manually modified codes should have "@Generated" annotation removed.
true - generating will overwrite manual changes (default)
false - generation will fail
-
getAddLastGenerationTag
final Boolean getAddLastGenerationTag()
Specifies whether the index of the generated codes should contain the 'lastGeneration' tag with the last generation execution timestamp.
-
setAddLastGenerationTag
final Unit setAddLastGenerationTag(Boolean addLastGenerationTag)
Specifies whether the index of the generated codes should contain the 'lastGeneration' tag with the last generation execution timestamp.
-
getAddLastUpdateTag
final Boolean getAddLastUpdateTag()
Specifies whether the entries in the index of generated codes should contain the tag "lastUpdate" with the timestamp of the last change of the generated code.
-
setAddLastUpdateTag
final Unit setAddLastUpdateTag(Boolean addLastUpdateTag)
Specifies whether the entries in the index of generated codes should contain the tag "lastUpdate" with the timestamp of the last change of the generated code.
-
getCharset
final Charset getCharset()
The charset for generated codes.
-
setCharset
final Unit setCharset(Charset charset)
The charset for generated codes.
-
getOverrideWhenDiffsInWhitespacesOnly
final Boolean getOverrideWhenDiffsInWhitespacesOnly()
The file will be overwritten even if the newly generated code differs from the old one only in whitespaces.
-
setOverrideWhenDiffsInWhitespacesOnly
final Unit setOverrideWhenDiffsInWhitespacesOnly(Boolean overrideWhenDiffsInWhitespacesOnly)
The file will be overwritten even if the newly generated code differs from the old one only in whitespaces.
-
getLineSeparator
final String getLineSeparator()
The line separator for generated codes.
-
setLineSeparator
final Unit setLineSeparator(String lineSeparator)
The line separator for generated codes.
-
getParams
final CodegenParams getParams()
-
getDataTypeMapper
final DataTypeMapper getDataTypeMapper()
-
setDataTypeMapper
final Unit setDataTypeMapper(DataTypeMapper dataTypeMapper)
-
getCodeIndex
final CodeIndex getCodeIndex()
-
cleanup
final Unit cleanup()
Deletes generated files present in the index file. Files with removed 'Generated' annotation will not be deleted.
-
totalCleanup
final Unit totalCleanup()
Deletes generated files present in the index file. Also, will be deleted files with removed 'Generated' annotation.
-
generate
final <M extends Model, T extends Any, B extends GeneratorBuilder<M, T, B>> Codegen generate(B generatorBuilder, GeneratorBuilder.Setter<B> setter)
Adds module generator to the code generation schedule. With builder version.
-
generate
final Codegen generate(Generator<?> generator)
Adds module generator to the code generation schedule.
-
restApi
@JvmOverloads() final MultipartRestApi restApi(File file, Charset charset)
-
restApi
@JvmOverloads() final MultipartRestApi restApi(File file)
-
wsdlApi
final WsdlApi wsdlApi(String wsdlLocation, Consumer<WsdlParserConfig> configurator)
-
addLastGenerationTag
final Codegen addLastGenerationTag(Boolean addLastGenerationTag)
-
addLastUpdateTag
final Codegen addLastUpdateTag(Boolean addLastUpdateTag)
-
overrideWhenDiffsInWhitespacesOnly
final Codegen overrideWhenDiffsInWhitespacesOnly(Boolean overrideWhenDiffsInWhitespacesOnly)
-
lineSeparator
final Codegen lineSeparator(String lineSeparator)
-
dataTypeMapper
final Codegen dataTypeMapper(Consumer<DataTypeMapper> setter)
-
params
final Codegen params(Consumer<CodegenParams> setter)
-
-
-
-