@@ -35,8 +35,6 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegenConfig {
35
35
protected String apiDocPath = "docs/" ;
36
36
protected String modelDocPath = "docs/" ;
37
37
38
- protected CodegenConstants .ENUM_PROPERTY_NAMING_TYPE enumPropertyNaming = CodegenConstants .ENUM_PROPERTY_NAMING_TYPE .camelCase ;
39
-
40
38
public AbstractKotlinCodegen () {
41
39
super ();
42
40
supportsInheritance = true ;
@@ -207,9 +205,6 @@ public AbstractKotlinCodegen() {
207
205
addOption (CodegenConstants .GROUP_ID , "Generated artifact package's organization (i.e. maven groupId)." , groupId );
208
206
addOption (CodegenConstants .ARTIFACT_ID , "Generated artifact id (name of jar)." , artifactId );
209
207
addOption (CodegenConstants .ARTIFACT_VERSION , "Generated artifact's package version." , artifactVersion );
210
-
211
- CliOption enumPropertyNamingOpt = new CliOption (CodegenConstants .ENUM_PROPERTY_NAMING , CodegenConstants .ENUM_PROPERTY_NAMING_DESC );
212
- cliOptions .add (enumPropertyNamingOpt .defaultValue (enumPropertyNaming .name ()));
213
208
}
214
209
215
210
protected void addOption (String key , String description ) {
@@ -260,27 +255,6 @@ public String escapeUnsafeCharacters(String input) {
260
255
return input .replace ("*/" , "*_/" ).replace ("/*" , "/_*" );
261
256
}
262
257
263
- public CodegenConstants .ENUM_PROPERTY_NAMING_TYPE getEnumPropertyNaming () {
264
- return this .enumPropertyNaming ;
265
- }
266
-
267
- /**
268
- * Sets the naming convention for Kotlin enum properties
269
- *
270
- * @param enumPropertyNamingType The string representation of the naming convention, as defined by {@link CodegenConstants.ENUM_PROPERTY_NAMING_TYPE}
271
- */
272
- public void setEnumPropertyNaming (final String enumPropertyNamingType ) {
273
- try {
274
- this .enumPropertyNaming = CodegenConstants .ENUM_PROPERTY_NAMING_TYPE .valueOf (enumPropertyNamingType );
275
- } catch (IllegalArgumentException ex ) {
276
- StringBuilder sb = new StringBuilder (enumPropertyNamingType + " is an invalid enum property naming option. Please choose from:" );
277
- for (CodegenConstants .ENUM_PROPERTY_NAMING_TYPE t : CodegenConstants .ENUM_PROPERTY_NAMING_TYPE .values ()) {
278
- sb .append ("\n " ).append (t .name ());
279
- }
280
- throw new RuntimeException (sb .toString ());
281
- }
282
- }
283
-
284
258
protected void updateCodegenModelEnumVars (CodegenModel codegenModel ) {
285
259
super .updateCodegenModelEnumVars (codegenModel );
286
260
for (CodegenProperty var : codegenModel .allVars ) {
@@ -361,10 +335,6 @@ public Map<String, Object> postProcessModels(Map<String, Object> objs) {
361
335
public void processOpts () {
362
336
super .processOpts ();
363
337
364
- if (additionalProperties .containsKey (CodegenConstants .ENUM_PROPERTY_NAMING )) {
365
- setEnumPropertyNaming ((String ) additionalProperties .get (CodegenConstants .ENUM_PROPERTY_NAMING ));
366
- }
367
-
368
338
if (additionalProperties .containsKey (CodegenConstants .SOURCE_FOLDER )) {
369
339
this .setSourceFolder ((String ) additionalProperties .get (CodegenConstants .SOURCE_FOLDER ));
370
340
} else {
@@ -447,28 +417,7 @@ public String toEnumVarName(String value, String datatype) {
447
417
modified = sanitizeKotlinSpecificNames (modified );
448
418
}
449
419
450
- switch (getEnumPropertyNaming ()) {
451
- case original :
452
- // NOTE: This is provided as a last-case allowance, but will still result in reserved words being escaped.
453
- modified = value ;
454
- break ;
455
- case camelCase :
456
- // NOTE: Removes hyphens and underscores
457
- modified = camelize (modified , true );
458
- break ;
459
- case PascalCase :
460
- // NOTE: Removes hyphens and underscores
461
- String result = camelize (modified );
462
- modified = titleCase (result );
463
- break ;
464
- case snake_case :
465
- // NOTE: Removes hyphens
466
- modified = underscore (modified );
467
- break ;
468
- case UPPERCASE :
469
- modified = modified .toUpperCase ();
470
- break ;
471
- }
420
+ modified = modified .toUpperCase ();
472
421
473
422
if (isReservedWord (modified )) {
474
423
return escapeReservedWord (modified );
0 commit comments