Skip to content

Commit fdda9fc

Browse files
authored
[Java] Replace if with ? in Generated toIndentedString-methods (#23209)
* [Java] Refactor `toIndentedString`-method to use `String::valueOf` Signed-off-by: Chrimle <28791817+Chrimle@users.noreply.github.com> * Update Generated Samples Signed-off-by: Chrimle <28791817+Chrimle@users.noreply.github.com> * Update Generated Samples Signed-off-by: Chrimle <28791817+Chrimle@users.noreply.github.com> * Update Generated Samples Signed-off-by: Chrimle <28791817+Chrimle@users.noreply.github.com> * Update Generated Samples Signed-off-by: Chrimle <28791817+Chrimle@users.noreply.github.com> * Update Generated Samples Signed-off-by: Chrimle <28791817+Chrimle@users.noreply.github.com> * Update Generated Samples Signed-off-by: Chrimle <28791817+Chrimle@users.noreply.github.com> * Update Generated Samples Signed-off-by: Chrimle <28791817+Chrimle@users.noreply.github.com> * Update Generated Samples Signed-off-by: Chrimle <28791817+Chrimle@users.noreply.github.com> * Update Generated Samples Signed-off-by: Chrimle <28791817+Chrimle@users.noreply.github.com> * Update Generated Samples Signed-off-by: Chrimle <28791817+Chrimle@users.noreply.github.com> * Update Generated Samples Signed-off-by: Chrimle <28791817+Chrimle@users.noreply.github.com> * Update Generated Samples Signed-off-by: Chrimle <28791817+Chrimle@users.noreply.github.com> * Update Generated Samples Signed-off-by: Chrimle <28791817+Chrimle@users.noreply.github.com> * Update Generated Samples Signed-off-by: Chrimle <28791817+Chrimle@users.noreply.github.com> * Update Generated Samples Signed-off-by: Chrimle <28791817+Chrimle@users.noreply.github.com> * Replace Conventional if-statment with Ternary Operator in `toIndentedString`-methods Signed-off-by: Chrimle <28791817+Chrimle@users.noreply.github.com> * Generate `j*` Samples Signed-off-by: Chrimle <28791817+Chrimle@users.noreply.github.com> * Generate `spring*` Samples Signed-off-by: Chrimle <28791817+Chrimle@users.noreply.github.com> * Generate `java-*` Samples Signed-off-by: Chrimle <28791817+Chrimle@users.noreply.github.com> * Generate `java-*` Samples Signed-off-by: Chrimle <28791817+Chrimle@users.noreply.github.com> --------- Signed-off-by: Chrimle <28791817+Chrimle@users.noreply.github.com>
1 parent 4fdc919 commit fdda9fc

File tree

4,998 files changed

+4998
-19992
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

4,998 files changed

+4998
-19992
lines changed

modules/openapi-generator/src/main/resources/Java/libraries/feign/pojo.mustache

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -318,10 +318,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
318318
* (except the first line).
319319
*/
320320
private{{#jsonb}} static{{/jsonb}} String toIndentedString(Object o) {
321-
if (o == null) {
322-
return "null";
323-
}
324-
return o.toString().replace("\n", "\n ");
321+
return o == null ? "null" : o.toString().replace("\n", "\n ");
325322
}
326323
{{#supportUrlQuery}}
327324

modules/openapi-generator/src/main/resources/Java/libraries/jersey2/AbstractOpenApiSchema.mustache

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,7 @@ public abstract class AbstractOpenApiSchema {
9797
* (except the first line).
9898
*/
9999
private String toIndentedString(Object o) {
100-
if (o == null) {
101-
return "null";
102-
}
103-
return o.toString().replace("\n", "\n ");
100+
return o == null ? "null" : o.toString().replace("\n", "\n ");
104101
}
105102

106103
public boolean equals(Object o) {

modules/openapi-generator/src/main/resources/Java/libraries/jersey2/pojo.mustache

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -338,10 +338,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
338338
* (except the first line).
339339
*/
340340
private String toIndentedString(Object o) {
341-
if (o == null) {
342-
return "null";
343-
}
344-
return o.toString().replace("\n", "\n ");
341+
return o == null ? "null" : o.toString().replace("\n", "\n ");
345342
}
346343
347344
{{#parcelableModel}}

modules/openapi-generator/src/main/resources/Java/libraries/jersey3/AbstractOpenApiSchema.mustache

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,7 @@ public abstract class AbstractOpenApiSchema {
9797
* (except the first line).
9898
*/
9999
private String toIndentedString(Object o) {
100-
if (o == null) {
101-
return "null";
102-
}
103-
return o.toString().replace("\n", "\n ");
100+
return o == null ? "null" : o.toString().replace("\n", "\n ");
104101
}
105102

106103
public boolean equals(Object o) {

modules/openapi-generator/src/main/resources/Java/libraries/jersey3/pojo.mustache

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -338,10 +338,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
338338
* (except the first line).
339339
*/
340340
private String toIndentedString(Object o) {
341-
if (o == null) {
342-
return "null";
343-
}
344-
return o.toString().replace("\n", "\n ");
341+
return o == null ? "null" : o.toString().replace("\n", "\n ");
345342
}
346343
347344
{{#parcelableModel}}

modules/openapi-generator/src/main/resources/Java/libraries/microprofile/pojoOverrides.mustache

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,5 @@
6363
* (except the first line).
6464
*/
6565
private static String toIndentedString(Object o) {
66-
if (o == null) {
67-
return "null";
68-
}
69-
return o.toString().replace("\n", "\n ");
66+
return o == null ? "null" : o.toString().replace("\n", "\n ");
7067
}

modules/openapi-generator/src/main/resources/Java/libraries/native/AbstractOpenApiSchema.mustache

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,7 @@ public abstract class AbstractOpenApiSchema {
9595
* (except the first line).
9696
*/
9797
private String toIndentedString(Object o) {
98-
if (o == null) {
99-
return "null";
100-
}
101-
return o.toString().replace("\n", "\n ");
98+
return o == null ? "null" : o.toString().replace("\n", "\n ");
10299
}
103100

104101
public boolean equals(Object o) {

modules/openapi-generator/src/main/resources/Java/libraries/native/pojo.mustache

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -342,10 +342,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
342342
* (except the first line).
343343
*/
344344
private String toIndentedString(Object o) {
345-
if (o == null) {
346-
return "null";
347-
}
348-
return o.toString().replace("\n", "\n ");
345+
return o == null ? "null" : o.toString().replace("\n", "\n ");
349346
}
350347
{{#supportUrlQuery}}
351348

modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/AbstractOpenApiSchema.mustache

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,7 @@ public abstract class AbstractOpenApiSchema {
9494
* (except the first line).
9595
*/
9696
private String toIndentedString(Object o) {
97-
if (o == null) {
98-
return "null";
99-
}
100-
return o.toString().replace("\n", "\n ");
97+
return o == null ? "null" : o.toString().replace("\n", "\n ");
10198
}
10299

103100
public boolean equals(Object o) {

modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/pojo.mustache

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -255,10 +255,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
255255
* (except the first line).
256256
*/
257257
private String toIndentedString(Object o) {
258-
if (o == null) {
259-
return "null";
260-
}
261-
return o.toString().replace("\n", "\n ");
258+
return o == null ? "null" : o.toString().replace("\n", "\n ");
262259
}
263260

264261
{{#parcelableModel}}

0 commit comments

Comments
 (0)