Skip to content

Commit 3bd6d67

Browse files
authored
(java client) minor code enhancements (#18493)
* (java client) minor code enhancements * update doc
1 parent 1bb4d42 commit 3bd6d67

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

docs/generators/java.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
4747
|dynamicOperations|Generate operations dynamically at runtime from an OAS| |false|
4848
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
4949
|enumUnknownDefaultCase|If the server adds new enum cases, that are unknown by an old spec/client, the client will fail to parse the network response.With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the server sends an enum case that is not known by the client/spec, they can safely fallback to this case.|<dl><dt>**false**</dt><dd>No changes to the enum's are made, this is the default option.</dd><dt>**true**</dt><dd>With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the enum case sent by the server is not known by the client/spec, can safely be decoded to this case.</dd></dl>|false|
50-
|errorObjectType|Error Object type. (This option is for okhttp-gson-next-gen only)| |null|
50+
|errorObjectType|Error Object type. (This option is for okhttp-gson only)| |null|
5151
|generateClientAsBean|For resttemplate, configure whether to create `ApiClient.java` and Apis clients as bean (with `@Component` annotation).| |false|
5252
|gradleProperties|Append additional Gradle properties to the gradle.properties file| |null|
5353
|groupId|groupId in generated pom.xml| |org.openapitools|

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

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,10 @@ public JavaClientCodegen() {
182182
.includeDocumentationFeatures(DocumentationFeature.Readme)
183183
.includeGlobalFeatures(GlobalFeature.ParameterizedServer)
184184
.includeSecurityFeatures(SecurityFeature.OAuth2_AuthorizationCode,
185-
SecurityFeature.OAuth2_ClientCredentials,
186-
SecurityFeature.OAuth2_Password,
187-
SecurityFeature.SignatureAuth,//jersey only
188-
SecurityFeature.AWSV4Signature)//okhttp-gson only
185+
SecurityFeature.OAuth2_ClientCredentials,
186+
SecurityFeature.OAuth2_Password,
187+
SecurityFeature.SignatureAuth,//jersey only
188+
SecurityFeature.AWSV4Signature)//okhttp-gson only
189189
);
190190

191191
outputFolder = "generated-code" + File.separator + "java";
@@ -222,7 +222,7 @@ public JavaClientCodegen() {
222222
cliOptions.add(CliOption.newBoolean(SUPPORT_STREAMING, "Support streaming endpoint (beta)", this.supportStreaming));
223223
cliOptions.add(CliOption.newBoolean(CodegenConstants.WITH_AWSV4_SIGNATURE_COMMENT, CodegenConstants.WITH_AWSV4_SIGNATURE_COMMENT_DESC + " (only available for okhttp-gson library)", this.withAWSV4Signature));
224224
cliOptions.add(CliOption.newString(GRADLE_PROPERTIES, "Append additional Gradle properties to the gradle.properties file"));
225-
cliOptions.add(CliOption.newString(ERROR_OBJECT_TYPE, "Error Object type. (This option is for okhttp-gson-next-gen only)"));
225+
cliOptions.add(CliOption.newString(ERROR_OBJECT_TYPE, "Error Object type. (This option is for okhttp-gson only)"));
226226
cliOptions.add(CliOption.newString(CONFIG_KEY, "Config key in @RegisterRestClient. Default to none. Only `microprofile` supports this option."));
227227
cliOptions.add(CliOption.newBoolean(CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP, CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP_DESC + " Only jersey2, jersey3, native, okhttp-gson support this option."));
228228
cliOptions.add(CliOption.newString(MICROPROFILE_REST_CLIENT_VERSION, "Version of MicroProfile Rest Client API."));
@@ -472,15 +472,13 @@ public void processOpts() {
472472

473473
if (additionalProperties.containsKey(CodegenConstants.MAX_ATTEMPTS_FOR_RETRY)) {
474474
this.setMaxAttemptsForRetry(Integer.parseInt(additionalProperties.get(CodegenConstants.MAX_ATTEMPTS_FOR_RETRY).toString()));
475-
}
476-
else {
475+
} else {
477476
additionalProperties.put(CodegenConstants.MAX_ATTEMPTS_FOR_RETRY, maxAttemptsForRetry);
478477
}
479478

480479
if (additionalProperties.containsKey(CodegenConstants.WAIT_TIME_OF_THREAD)) {
481480
this.setWaitTimeMillis(Long.parseLong((additionalProperties.get(CodegenConstants.WAIT_TIME_OF_THREAD).toString())));
482-
}
483-
else {
481+
} else {
484482
additionalProperties.put(CodegenConstants.WAIT_TIME_OF_THREAD, waitTimeMillis);
485483
}
486484
writePropertyBack(USE_ENUM_CASE_INSENSITIVE, useEnumCaseInsensitive);
@@ -1264,11 +1262,11 @@ public void setUseEnumCaseInsensitive(boolean useEnumCaseInsensitive) {
12641262
}
12651263

12661264
public void setMaxAttemptsForRetry(int maxAttemptsForRetry) {
1267-
this.maxAttemptsForRetry= maxAttemptsForRetry;
1265+
this.maxAttemptsForRetry = maxAttemptsForRetry;
12681266
}
12691267

12701268
public void setWaitTimeMillis(long waitTimeMillis) {
1271-
this.waitTimeMillis= waitTimeMillis;
1269+
this.waitTimeMillis = waitTimeMillis;
12721270
}
12731271

12741272
/**

0 commit comments

Comments
 (0)