22
22
import org .apache .commons .lang3 .BooleanUtils ;
23
23
import org .apache .commons .lang3 .StringUtils ;
24
24
import org .openapitools .codegen .*;
25
- import org .openapitools .codegen .config .GlobalSettings ;
26
25
import org .openapitools .codegen .languages .features .BeanValidationFeatures ;
27
26
import org .openapitools .codegen .languages .features .GzipFeatures ;
28
27
import org .openapitools .codegen .languages .features .PerformBeanValidationFeatures ;
40
39
import static com .google .common .base .CaseFormat .LOWER_CAMEL ;
41
40
import static com .google .common .base .CaseFormat .UPPER_UNDERSCORE ;
42
41
import static java .util .Collections .sort ;
43
- import static org .openapitools .codegen .utils .OnceLogger .once ;
44
42
import static org .openapitools .codegen .utils .StringUtils .camelize ;
45
43
46
44
public class JavaClientCodegen extends AbstractJavaCodegen
@@ -96,7 +94,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen
96
94
// (mustache does not allow for boolean operators so we need this extra field)
97
95
protected boolean doNotUseRx = true ;
98
96
protected boolean usePlayWS = false ;
99
- protected String playVersion = PLAY_25 ;
97
+ protected String playVersion = PLAY_26 ;
100
98
protected String microprofileFramework = MICROPROFILE_DEFAULT ;
101
99
102
100
protected boolean asyncNative = false ;
@@ -221,27 +219,27 @@ public void processOpts() {
221
219
super .processOpts ();
222
220
223
221
// RxJava
224
- if (additionalProperties .containsKey (USE_RX_JAVA ) && additionalProperties .containsKey (USE_RX_JAVA2 ) && additionalProperties .containsKey (USE_RX_JAVA3 )){
222
+ if (additionalProperties .containsKey (USE_RX_JAVA ) && additionalProperties .containsKey (USE_RX_JAVA2 ) && additionalProperties .containsKey (USE_RX_JAVA3 )) {
225
223
LOGGER .warn ("You specified all RxJava versions 1, 2 and 3 but they are mutually exclusive. Defaulting to v3." );
226
224
this .setUseRxJava3 (Boolean .valueOf (additionalProperties .get (USE_RX_JAVA3 ).toString ()));
227
- }else {
228
- if (additionalProperties .containsKey (USE_RX_JAVA ) && additionalProperties .containsKey (USE_RX_JAVA2 )){
225
+ } else {
226
+ if (additionalProperties .containsKey (USE_RX_JAVA ) && additionalProperties .containsKey (USE_RX_JAVA2 )) {
229
227
LOGGER .warn ("You specified both RxJava versions 1 and 2 but they are mutually exclusive. Defaulting to v2." );
230
228
this .setUseRxJava2 (Boolean .valueOf (additionalProperties .get (USE_RX_JAVA2 ).toString ()));
231
- }else if (additionalProperties .containsKey (USE_RX_JAVA ) && additionalProperties .containsKey (USE_RX_JAVA3 )) {
229
+ } else if (additionalProperties .containsKey (USE_RX_JAVA ) && additionalProperties .containsKey (USE_RX_JAVA3 )) {
232
230
LOGGER .warn ("You specified both RxJava versions 1 and 3 but they are mutually exclusive. Defaulting to v3." );
233
231
this .setUseRxJava3 (Boolean .valueOf (additionalProperties .get (USE_RX_JAVA3 ).toString ()));
234
- }else if (additionalProperties .containsKey (USE_RX_JAVA2 ) && additionalProperties .containsKey (USE_RX_JAVA3 )){
232
+ } else if (additionalProperties .containsKey (USE_RX_JAVA2 ) && additionalProperties .containsKey (USE_RX_JAVA3 )) {
235
233
LOGGER .warn ("You specified both RxJava versions 2 and 3 but they are mutually exclusive. Defaulting to v3." );
236
234
this .setUseRxJava3 (Boolean .valueOf (additionalProperties .get (USE_RX_JAVA3 ).toString ()));
237
- }else {
238
- if (additionalProperties .containsKey (USE_RX_JAVA )){
235
+ } else {
236
+ if (additionalProperties .containsKey (USE_RX_JAVA )) {
239
237
this .setUseRxJava (Boolean .valueOf (additionalProperties .get (USE_RX_JAVA ).toString ()));
240
238
}
241
- if (additionalProperties .containsKey (USE_RX_JAVA2 )){
239
+ if (additionalProperties .containsKey (USE_RX_JAVA2 )) {
242
240
this .setUseRxJava2 (Boolean .valueOf (additionalProperties .get (USE_RX_JAVA2 ).toString ()));
243
241
}
244
- if (additionalProperties .containsKey (USE_RX_JAVA3 )){
242
+ if (additionalProperties .containsKey (USE_RX_JAVA3 )) {
245
243
this .setUseRxJava3 (Boolean .valueOf (additionalProperties .get (USE_RX_JAVA3 ).toString ()));
246
244
}
247
245
}
@@ -264,12 +262,10 @@ public void processOpts() {
264
262
265
263
// Microprofile framework
266
264
if (additionalProperties .containsKey (MICROPROFILE_FRAMEWORK )) {
267
- this .setMicroprofileFramework (additionalProperties .get (MICROPROFILE_FRAMEWORK ).toString ());
268
-
269
265
if (!MICROPROFILE_KUMULUZEE .equals (microprofileFramework )) {
270
- throw new RuntimeException ("Ivalid microprofileFramework '{} '. Must be 'kumuluzee' or none." );
266
+ throw new RuntimeException ("Invalid microprofileFramework '" + microprofileFramework + " '. Must be 'kumuluzee' or none." );
271
267
}
272
-
268
+ this . setMicroprofileFramework ( additionalProperties . get ( MICROPROFILE_FRAMEWORK ). toString ());
273
269
}
274
270
additionalProperties .put (MICROPROFILE_FRAMEWORK , microprofileFramework );
275
271
@@ -468,7 +464,7 @@ public void processOpts() {
468
464
supportingFiles .add (new SupportingFile ("api_exception_mapper.mustache" , apiExceptionFolder , "ApiExceptionMapper.java" ));
469
465
serializationLibrary = "none" ;
470
466
471
- if (microprofileFramework .equals (MICROPROFILE_KUMULUZEE )){
467
+ if (microprofileFramework .equals (MICROPROFILE_KUMULUZEE )) {
472
468
supportingFiles .add (new SupportingFile ("kumuluzee.pom.mustache" , "" , "pom.xml" ));
473
469
supportingFiles .add (new SupportingFile ("kumuluzee.config.yaml.mustache" , "src/main/resources" , "config.yaml" ));
474
470
supportingFiles .add (new SupportingFile ("kumuluzee.beans.xml.mustache" , "src/main/resources/META-INF" , "beans.xml" ));
@@ -846,7 +842,7 @@ public void setUseRxJava2(boolean useRxJava2) {
846
842
this .useRxJava2 = useRxJava2 ;
847
843
doNotUseRx = false ;
848
844
}
849
-
845
+
850
846
public void setUseRxJava3 (boolean useRxJava3 ) {
851
847
this .useRxJava3 = useRxJava3 ;
852
848
doNotUseRx = false ;
0 commit comments