Skip to content

Commit e270238

Browse files
committed
Replace Conventional if-statment with Ternary Operator in toIndentedString-methods
Signed-off-by: Chrimle <28791817+Chrimle@users.noreply.github.com>
1 parent 1fbe282 commit e270238

38 files changed

Lines changed: 38 additions & 38 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +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-
return String.valueOf(o).replace("\n", "\n ");
321+
return o == null ? "null" : o.toString().replace("\n", "\n ");
322322
}
323323
{{#supportUrlQuery}}
324324

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public abstract class AbstractOpenApiSchema {
9797
* (except the first line).
9898
*/
9999
private String toIndentedString(Object o) {
100-
return String.valueOf(o).replace("\n", "\n ");
100+
return o == null ? "null" : o.toString().replace("\n", "\n ");
101101
}
102102

103103
public boolean equals(Object o) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
338338
* (except the first line).
339339
*/
340340
private String toIndentedString(Object o) {
341-
return String.valueOf(o).replace("\n", "\n ");
341+
return o == null ? "null" : o.toString().replace("\n", "\n ");
342342
}
343343
344344
{{#parcelableModel}}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public abstract class AbstractOpenApiSchema {
9797
* (except the first line).
9898
*/
9999
private String toIndentedString(Object o) {
100-
return String.valueOf(o).replace("\n", "\n ");
100+
return o == null ? "null" : o.toString().replace("\n", "\n ");
101101
}
102102

103103
public boolean equals(Object o) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
338338
* (except the first line).
339339
*/
340340
private String toIndentedString(Object o) {
341-
return String.valueOf(o).replace("\n", "\n ");
341+
return o == null ? "null" : o.toString().replace("\n", "\n ");
342342
}
343343
344344
{{#parcelableModel}}

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

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

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public abstract class AbstractOpenApiSchema {
9595
* (except the first line).
9696
*/
9797
private String toIndentedString(Object o) {
98-
return String.valueOf(o).replace("\n", "\n ");
98+
return o == null ? "null" : o.toString().replace("\n", "\n ");
9999
}
100100

101101
public boolean equals(Object o) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
342342
* (except the first line).
343343
*/
344344
private String toIndentedString(Object o) {
345-
return String.valueOf(o).replace("\n", "\n ");
345+
return o == null ? "null" : o.toString().replace("\n", "\n ");
346346
}
347347
{{#supportUrlQuery}}
348348

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public abstract class AbstractOpenApiSchema {
9494
* (except the first line).
9595
*/
9696
private String toIndentedString(Object o) {
97-
return String.valueOf(o).replace("\n", "\n ");
97+
return o == null ? "null" : o.toString().replace("\n", "\n ");
9898
}
9999

100100
public boolean equals(Object o) {

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

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

261261
{{#parcelableModel}}

0 commit comments

Comments
 (0)