Package io.swagger.codegen.languages
Class AbstractScalaCodegen
- java.lang.Object
-
- io.swagger.codegen.DefaultCodegen
-
- io.swagger.codegen.languages.AbstractScalaCodegen
-
- Direct Known Subclasses:
AkkaScalaClientCodegen,ScalaClientCodegen,ScalaLagomServerCodegen,ScalatraServerCodegen,ScalazClientCodegen
public abstract class AbstractScalaCodegen extends DefaultCodegen
-
-
Field Summary
Fields Modifier and Type Field Description protected StringinvokerPackageprotected StringmodelPropertyNamingprotected StringsourceFolderprotected booleanstripPackageName-
Fields inherited from class io.swagger.codegen.DefaultCodegen
additionalProperties, allowUnicodeIdentifiers, apiDocTemplateFiles, apiPackage, apiTemplateFiles, apiTestTemplateFiles, cliOptions, commonTemplateDir, defaultIncludes, embeddedTemplateDir, ensureUniqueParams, fileSuffix, gitRepoBaseURL, gitRepoId, gitUserId, hideGenerationTimestamp, httpUserAgent, ignoreFilePathOverride, ignoreImportMapping, importMapping, inputSpec, instantiationTypes, languageSpecificPrimitives, library, LOGGER, modelDocTemplateFiles, modelNamePrefix, modelNameSuffix, modelPackage, modelTemplateFiles, modelTestTemplateFiles, outputFolder, releaseNote, removeOperationIdPrefix, reservedWords, reservedWordsMappings, skipAliasGeneration, skipOverwrite, sortParamsByRequiredFlag, specialCharReplacements, supportedLibraries, supportingFiles, supportsInheritance, supportsMixins, templateDir, testPackage, typeAliases, typeMapping, vendorExtensions
-
-
Constructor Summary
Constructors Constructor Description AbstractScalaCodegen()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringapiFileFolder()StringescapeQuotationMark(String input)Escape single and/or double quote to avoid code injectionStringescapeReservedWord(String name)Return the escaped name of the reserved wordStringescapeUnsafeCharacters(String input)override with any special text escaping logic to handle unsafe characters so as to avoid code injectionprotected StringformatIdentifier(String name, boolean capitalized)StringgetSourceFolder()StringgetSwaggerType(io.swagger.models.properties.Property p)returns the swagger type for the propertyStringgetTypeDeclaration(io.swagger.models.properties.Property p)Output the type declaration of the propertyStringmodelFileFolder()Map<String,Object>postProcessModels(Map<String,Object> objs)com.samskivert.mustache.Mustache.CompilerprocessCompiler(com.samskivert.mustache.Mustache.Compiler compiler)voidprocessOpts()voidsetSourceFolder(String sourceFolder)protected StringstripPackageName(String input)StringtoDefaultValue(io.swagger.models.properties.Property p)Return the default value of the propertyStringtoInstantiationType(io.swagger.models.properties.Property p)Return the instantiation type of the property, especially for map and arrayStringtoModelFilename(String name)Return the capitalized file name of the model-
Methods inherited from class io.swagger.codegen.DefaultCodegen
addAdditionPropertiesToCodeGenModel, addImport, additionalProperties, addOperationToGroup, addOption, addOption, addParentContainer, addProperties, addRegularExpressionDelimiter, addSwitch, apiDocFileFolder, apiDocFilename, apiDocTemplateFiles, apiFilename, apiPackage, apiTemplateFiles, apiTestFileFolder, apiTestFilename, apiTestTemplateFiles, buildLibraryCliOption, camelize, camelize, cliOptions, configureDataForTestTemplate, convertPropertyToBoolean, convertPropertyToBooleanAndWriteBack, dashize, defaultIgnoreImportMappingOption, defaultIncludes, embeddedTemplateDir, ensureUniqueName, escapeText, fileSuffix, findCommonPrefixOfVars, findMethodResponse, fixUpParentAndInterfaces, fromModel, fromModel, fromOperation, fromOperation, fromParameter, fromProperty, fromResponse, fromSecurity, generateExamplePath, getAlias, getAllAliases, getCommonTemplateDir, getExamples, getGitRepoBaseURL, getGitRepoId, getGitUserId, getHttpUserAgent, getIgnoreFilePathOverride, getIgnoreImportMapping, getInnerEnumAllowableValues, getInputSpec, getLibrary, getOrGenerateOperationId, getOutputDir, getParameterDataType, getReleaseNote, getSkipAliasGeneration, getSymbolName, getterAndSetterCapitalize, getTypeDeclaration, importMapping, initalizeSpecialCharacterMapping, initialCaps, instantiationTypes, isDataTypeBinary, isDataTypeFile, isHideGenerationTimestamp, isModelObject, isPrimivite, isPropertyInnerMostEnum, isRemoveOperationIdPrefix, isReservedWord, isSkipOverwrite, isUsingFlattenSpec, languageSpecificPrimitives, modelDocFileFolder, modelDocTemplateFiles, modelFilename, modelPackage, modelTemplateFiles, modelTestFileFolder, modelTestTemplateFiles, needToImport, outputFolder, postProcessAllModels, postProcessModelProperties, postProcessModelProperty, postProcessModelsEnum, postProcessOperations, postProcessOperationsWithModels, postProcessParameter, postProcessSupportingFileData, preprocessSwagger, processSwagger, readRefModelParameter, removeNonNameElementToCamelCase, removeNonNameElementToCamelCase, reservedWords, reservedWordsMappings, sanitizeName, sanitizeTag, setAllowUnicodeIdentifiers, setApiPackage, setCommonTemplateDir, setEnsureUniqueParams, setGitRepoBaseURL, setGitRepoId, setGitUserId, setHideGenerationTimestamp, setHttpUserAgent, setIgnoreFilePathOverride, setIgnoreImportMapping, setInputSpec, setLibrary, setModelNamePrefix, setModelNameSuffix, setModelPackage, setNonArrayMapProperty, setOutputDir, setParameterBooleanFlagWithCodegenProperty, setParameterExampleValue, setReleaseNote, setRemoveOperationIdPrefix, setReservedWordsLowerCase, setSkipAliasGeneration, setSkipOverwrite, setSortParamsByRequiredFlag, setTemplateDir, shouldOverwrite, snakeCase, supportedLibraries, supportingFiles, templateDir, testPackage, titleCase, toApiDocFilename, toApiFilename, toApiImport, toApiName, toApiTestFilename, toApiVarName, toBooleanGetter, toDefaultValueWithParam, toEnumDefaultValue, toEnumName, toEnumValue, toEnumVarName, toExamples, toExampleValue, toGetter, toModelDocFilename, toModelImport, toModelName, toModelTestFilename, toOperationId, toParamName, toRegularExpression, toSetter, toVarName, typeMapping, underscore, updateCodegenPropertyEnum, updateDataTypeWithEnumForArray, updateDataTypeWithEnumForMap, updatePropertyForArray, updatePropertyForMap, vendorExtensions, writeOptional, writePropertyBack
-
-
-
-
Method Detail
-
processOpts
public void processOpts()
- Overrides:
processOptsin classDefaultCodegen
-
setSourceFolder
public void setSourceFolder(String sourceFolder)
-
getSourceFolder
public String getSourceFolder()
-
escapeReservedWord
public String escapeReservedWord(String name)
Description copied from class:DefaultCodegenReturn the escaped name of the reserved word- Overrides:
escapeReservedWordin classDefaultCodegen- Parameters:
name- the name to be escaped- Returns:
- the escaped reserved word throws Runtime exception as reserved word is not allowed (default behavior)
-
processCompiler
public com.samskivert.mustache.Mustache.Compiler processCompiler(com.samskivert.mustache.Mustache.Compiler compiler)
- Overrides:
processCompilerin classDefaultCodegen
-
apiFileFolder
public String apiFileFolder()
- Overrides:
apiFileFolderin classDefaultCodegen
-
modelFileFolder
public String modelFileFolder()
- Overrides:
modelFileFolderin classDefaultCodegen
-
getTypeDeclaration
public String getTypeDeclaration(io.swagger.models.properties.Property p)
Description copied from class:DefaultCodegenOutput the type declaration of the property- Overrides:
getTypeDeclarationin classDefaultCodegen- Parameters:
p- Swagger Property object- Returns:
- a string presentation of the property type
-
getSwaggerType
public String getSwaggerType(io.swagger.models.properties.Property p)
Description copied from class:DefaultCodegenreturns the swagger type for the property- Overrides:
getSwaggerTypein classDefaultCodegen- Parameters:
p- Swagger property object- Returns:
- string presentation of the type
-
toInstantiationType
public String toInstantiationType(io.swagger.models.properties.Property p)
Description copied from class:DefaultCodegenReturn the instantiation type of the property, especially for map and array- Overrides:
toInstantiationTypein classDefaultCodegen- Parameters:
p- Swagger property object- Returns:
- string presentation of the instantiation type of the property
-
toDefaultValue
public String toDefaultValue(io.swagger.models.properties.Property p)
Description copied from class:DefaultCodegenReturn the default value of the property- Overrides:
toDefaultValuein classDefaultCodegen- Parameters:
p- Swagger property object- Returns:
- string presentation of the default value of the property
-
postProcessModels
public Map<String,Object> postProcessModels(Map<String,Object> objs)
- Overrides:
postProcessModelsin classDefaultCodegen
-
toModelFilename
public String toModelFilename(String name)
Description copied from class:DefaultCodegenReturn the capitalized file name of the model- Overrides:
toModelFilenamein classDefaultCodegen- Parameters:
name- the model name- Returns:
- the file name of the model
-
escapeUnsafeCharacters
public String escapeUnsafeCharacters(String input)
Description copied from class:DefaultCodegenoverride with any special text escaping logic to handle unsafe characters so as to avoid code injection- Overrides:
escapeUnsafeCharactersin classDefaultCodegen- Parameters:
input- String to be cleaned up- Returns:
- string with unsafe characters removed or escaped
-
escapeQuotationMark
public String escapeQuotationMark(String input)
Description copied from class:DefaultCodegenEscape single and/or double quote to avoid code injection- Overrides:
escapeQuotationMarkin classDefaultCodegen- Parameters:
input- String to be cleaned up- Returns:
- string with quotation mark removed or escaped
-
-