Skip to content

Commit 06ab5b5

Browse files
authored
minor enhancement to java client generator (#7253)
1 parent d3017ff commit 06ab5b5

File tree

1 file changed

+14
-18
lines changed

1 file changed

+14
-18
lines changed

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import org.apache.commons.lang3.BooleanUtils;
2323
import org.apache.commons.lang3.StringUtils;
2424
import org.openapitools.codegen.*;
25-
import org.openapitools.codegen.config.GlobalSettings;
2625
import org.openapitools.codegen.languages.features.BeanValidationFeatures;
2726
import org.openapitools.codegen.languages.features.GzipFeatures;
2827
import org.openapitools.codegen.languages.features.PerformBeanValidationFeatures;
@@ -40,7 +39,6 @@
4039
import static com.google.common.base.CaseFormat.LOWER_CAMEL;
4140
import static com.google.common.base.CaseFormat.UPPER_UNDERSCORE;
4241
import static java.util.Collections.sort;
43-
import static org.openapitools.codegen.utils.OnceLogger.once;
4442
import static org.openapitools.codegen.utils.StringUtils.camelize;
4543

4644
public class JavaClientCodegen extends AbstractJavaCodegen
@@ -96,7 +94,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen
9694
// (mustache does not allow for boolean operators so we need this extra field)
9795
protected boolean doNotUseRx = true;
9896
protected boolean usePlayWS = false;
99-
protected String playVersion = PLAY_25;
97+
protected String playVersion = PLAY_26;
10098
protected String microprofileFramework = MICROPROFILE_DEFAULT;
10199

102100
protected boolean asyncNative = false;
@@ -221,27 +219,27 @@ public void processOpts() {
221219
super.processOpts();
222220

223221
// 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)) {
225223
LOGGER.warn("You specified all RxJava versions 1, 2 and 3 but they are mutually exclusive. Defaulting to v3.");
226224
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)) {
229227
LOGGER.warn("You specified both RxJava versions 1 and 2 but they are mutually exclusive. Defaulting to v2.");
230228
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)) {
232230
LOGGER.warn("You specified both RxJava versions 1 and 3 but they are mutually exclusive. Defaulting to v3.");
233231
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)) {
235233
LOGGER.warn("You specified both RxJava versions 2 and 3 but they are mutually exclusive. Defaulting to v3.");
236234
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)) {
239237
this.setUseRxJava(Boolean.valueOf(additionalProperties.get(USE_RX_JAVA).toString()));
240238
}
241-
if(additionalProperties.containsKey(USE_RX_JAVA2)){
239+
if (additionalProperties.containsKey(USE_RX_JAVA2)) {
242240
this.setUseRxJava2(Boolean.valueOf(additionalProperties.get(USE_RX_JAVA2).toString()));
243241
}
244-
if(additionalProperties.containsKey(USE_RX_JAVA3)){
242+
if (additionalProperties.containsKey(USE_RX_JAVA3)) {
245243
this.setUseRxJava3(Boolean.valueOf(additionalProperties.get(USE_RX_JAVA3).toString()));
246244
}
247245
}
@@ -264,12 +262,10 @@ public void processOpts() {
264262

265263
// Microprofile framework
266264
if (additionalProperties.containsKey(MICROPROFILE_FRAMEWORK)) {
267-
this.setMicroprofileFramework(additionalProperties.get(MICROPROFILE_FRAMEWORK).toString());
268-
269265
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.");
271267
}
272-
268+
this.setMicroprofileFramework(additionalProperties.get(MICROPROFILE_FRAMEWORK).toString());
273269
}
274270
additionalProperties.put(MICROPROFILE_FRAMEWORK, microprofileFramework);
275271

@@ -468,7 +464,7 @@ public void processOpts() {
468464
supportingFiles.add(new SupportingFile("api_exception_mapper.mustache", apiExceptionFolder, "ApiExceptionMapper.java"));
469465
serializationLibrary = "none";
470466

471-
if (microprofileFramework.equals(MICROPROFILE_KUMULUZEE)){
467+
if (microprofileFramework.equals(MICROPROFILE_KUMULUZEE)) {
472468
supportingFiles.add(new SupportingFile("kumuluzee.pom.mustache", "", "pom.xml"));
473469
supportingFiles.add(new SupportingFile("kumuluzee.config.yaml.mustache", "src/main/resources", "config.yaml"));
474470
supportingFiles.add(new SupportingFile("kumuluzee.beans.xml.mustache", "src/main/resources/META-INF", "beans.xml"));
@@ -846,7 +842,7 @@ public void setUseRxJava2(boolean useRxJava2) {
846842
this.useRxJava2 = useRxJava2;
847843
doNotUseRx = false;
848844
}
849-
845+
850846
public void setUseRxJava3(boolean useRxJava3) {
851847
this.useRxJava3 = useRxJava3;
852848
doNotUseRx = false;

0 commit comments

Comments
 (0)