mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-08 22:46:09 +00:00
[Java][Spring] fix imports for nullable helpers (#10234)
This commit is contained in:
@@ -840,6 +840,10 @@ public class SpringCodegen extends AbstractJavaCodegen
|
||||
if (property.isByteArray) {
|
||||
model.imports.add("Arrays");
|
||||
}
|
||||
|
||||
if (model.getVendorExtensions().containsKey("x-jackson-optional-nullable-helpers")) {
|
||||
model.imports.add("Arrays");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -287,7 +287,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
|
||||
}{{#vendorExtensions.x-jackson-optional-nullable-helpers}}
|
||||
|
||||
private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b) {
|
||||
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && a.get().getClass().isArray() ? Arrays.equals((T[])a.get(), (T[])b.get()) : Objects.equals(a.get(), b.get()));
|
||||
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get()));
|
||||
}{{/vendorExtensions.x-jackson-optional-nullable-helpers}}
|
||||
|
||||
@Override
|
||||
@@ -304,9 +304,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
|
||||
if (a == null) {
|
||||
return 1;
|
||||
}
|
||||
return a.isPresent()
|
||||
? (a.get().getClass().isArray() ? Arrays.hashCode((T[])a.get()) : Objects.hashCode(a.get()))
|
||||
: 31;
|
||||
return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31;
|
||||
}{{/vendorExtensions.x-jackson-optional-nullable-helpers}}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -290,7 +290,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
|
||||
}{{#vendorExtensions.x-jackson-optional-nullable-helpers}}
|
||||
|
||||
private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b) {
|
||||
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && a.get().getClass().isArray() ? Arrays.equals((T[])a.get(), (T[])b.get()) : Objects.equals(a.get(), b.get()));
|
||||
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get()));
|
||||
}{{/vendorExtensions.x-jackson-optional-nullable-helpers}}
|
||||
|
||||
@Override
|
||||
@@ -307,9 +307,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
|
||||
if (a == null) {
|
||||
return 1;
|
||||
}
|
||||
return a.isPresent()
|
||||
? (a.get().getClass().isArray() ? Arrays.hashCode((T[])a.get()) : Objects.hashCode(a.get()))
|
||||
: 31;
|
||||
return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31;
|
||||
}{{/vendorExtensions.x-jackson-optional-nullable-helpers}}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -263,7 +263,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
|
||||
}{{#vendorExtensions.x-jackson-optional-nullable-helpers}}
|
||||
|
||||
private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b) {
|
||||
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && a.get().getClass().isArray() ? Arrays.equals((T[])a.get(), (T[])b.get()) : Objects.equals(a.get(), b.get()));
|
||||
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get()));
|
||||
}{{/vendorExtensions.x-jackson-optional-nullable-helpers}}
|
||||
|
||||
@Override
|
||||
@@ -280,9 +280,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
|
||||
if (a == null) {
|
||||
return 1;
|
||||
}
|
||||
return a.isPresent()
|
||||
? (a.get().getClass().isArray() ? Arrays.hashCode((T[])a.get()) : Objects.hashCode(a.get()))
|
||||
: 31;
|
||||
return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31;
|
||||
}{{/vendorExtensions.x-jackson-optional-nullable-helpers}}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -139,7 +139,7 @@ public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}}{{^parent}}{{#ha
|
||||
}{{#vendorExtensions.x-jackson-optional-nullable-helpers}}
|
||||
|
||||
private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b) {
|
||||
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && a.get().getClass().isArray() ? Arrays.equals((T[])a.get(), (T[])b.get()) : Objects.equals(a.get(), b.get()));
|
||||
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get()));
|
||||
}{{/vendorExtensions.x-jackson-optional-nullable-helpers}}
|
||||
|
||||
@Override
|
||||
@@ -151,9 +151,7 @@ public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}}{{^parent}}{{#ha
|
||||
if (a == null) {
|
||||
return 1;
|
||||
}
|
||||
return a.isPresent()
|
||||
? (a.get().getClass().isArray() ? Arrays.hashCode((T[])a.get()) : Objects.hashCode(a.get()))
|
||||
: 31;
|
||||
return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31;
|
||||
}{{/vendorExtensions.x-jackson-optional-nullable-helpers}}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -461,7 +461,7 @@ public class EnumTest {
|
||||
}
|
||||
|
||||
private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b) {
|
||||
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && a.get().getClass().isArray() ? Arrays.equals((T[])a.get(), (T[])b.get()) : Objects.equals(a.get(), b.get()));
|
||||
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -473,9 +473,7 @@ public class EnumTest {
|
||||
if (a == null) {
|
||||
return 1;
|
||||
}
|
||||
return a.isPresent()
|
||||
? (a.get().getClass().isArray() ? Arrays.hashCode((T[])a.get()) : Objects.hashCode(a.get()))
|
||||
: 31;
|
||||
return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -90,7 +90,7 @@ public class HealthCheckResult {
|
||||
}
|
||||
|
||||
private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b) {
|
||||
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && a.get().getClass().isArray() ? Arrays.equals((T[])a.get(), (T[])b.get()) : Objects.equals(a.get(), b.get()));
|
||||
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -102,9 +102,7 @@ public class HealthCheckResult {
|
||||
if (a == null) {
|
||||
return 1;
|
||||
}
|
||||
return a.isPresent()
|
||||
? (a.get().getClass().isArray() ? Arrays.hashCode((T[])a.get()) : Objects.hashCode(a.get()))
|
||||
: 31;
|
||||
return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -585,7 +585,7 @@ public class NullableClass extends HashMap<String, Object> {
|
||||
}
|
||||
|
||||
private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b) {
|
||||
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && a.get().getClass().isArray() ? Arrays.equals((T[])a.get(), (T[])b.get()) : Objects.equals(a.get(), b.get()));
|
||||
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -597,9 +597,7 @@ public class NullableClass extends HashMap<String, Object> {
|
||||
if (a == null) {
|
||||
return 1;
|
||||
}
|
||||
return a.isPresent()
|
||||
? (a.get().getClass().isArray() ? Arrays.hashCode((T[])a.get()) : Objects.hashCode(a.get()))
|
||||
: 31;
|
||||
return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -226,7 +226,7 @@ public class ByteArrayObject {
|
||||
}
|
||||
|
||||
private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b) {
|
||||
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && a.get().getClass().isArray() ? Arrays.equals((T[])a.get(), (T[])b.get()) : Objects.equals(a.get(), b.get()));
|
||||
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -238,9 +238,7 @@ public class ByteArrayObject {
|
||||
if (a == null) {
|
||||
return 1;
|
||||
}
|
||||
return a.isPresent()
|
||||
? (a.get().getClass().isArray() ? Arrays.hashCode((T[])a.get()) : Objects.hashCode(a.get()))
|
||||
: 31;
|
||||
return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -461,7 +461,7 @@ public class EnumTest {
|
||||
}
|
||||
|
||||
private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b) {
|
||||
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && a.get().getClass().isArray() ? Arrays.equals((T[])a.get(), (T[])b.get()) : Objects.equals(a.get(), b.get()));
|
||||
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -473,9 +473,7 @@ public class EnumTest {
|
||||
if (a == null) {
|
||||
return 1;
|
||||
}
|
||||
return a.isPresent()
|
||||
? (a.get().getClass().isArray() ? Arrays.hashCode((T[])a.get()) : Objects.hashCode(a.get()))
|
||||
: 31;
|
||||
return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -90,7 +90,7 @@ public class HealthCheckResult {
|
||||
}
|
||||
|
||||
private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b) {
|
||||
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && a.get().getClass().isArray() ? Arrays.equals((T[])a.get(), (T[])b.get()) : Objects.equals(a.get(), b.get()));
|
||||
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -102,9 +102,7 @@ public class HealthCheckResult {
|
||||
if (a == null) {
|
||||
return 1;
|
||||
}
|
||||
return a.isPresent()
|
||||
? (a.get().getClass().isArray() ? Arrays.hashCode((T[])a.get()) : Objects.hashCode(a.get()))
|
||||
: 31;
|
||||
return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -585,7 +585,7 @@ public class NullableClass extends HashMap<String, Object> {
|
||||
}
|
||||
|
||||
private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b) {
|
||||
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && a.get().getClass().isArray() ? Arrays.equals((T[])a.get(), (T[])b.get()) : Objects.equals(a.get(), b.get()));
|
||||
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -597,9 +597,7 @@ public class NullableClass extends HashMap<String, Object> {
|
||||
if (a == null) {
|
||||
return 1;
|
||||
}
|
||||
return a.isPresent()
|
||||
? (a.get().getClass().isArray() ? Arrays.hashCode((T[])a.get()) : Objects.hashCode(a.get()))
|
||||
: 31;
|
||||
return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -346,7 +346,7 @@ public class AdditionalPropertiesClass {
|
||||
}
|
||||
|
||||
private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b) {
|
||||
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && a.get().getClass().isArray() ? Arrays.equals((T[])a.get(), (T[])b.get()) : Objects.equals(a.get(), b.get()));
|
||||
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -358,9 +358,7 @@ public class AdditionalPropertiesClass {
|
||||
if (a == null) {
|
||||
return 1;
|
||||
}
|
||||
return a.isPresent()
|
||||
? (a.get().getClass().isArray() ? Arrays.hashCode((T[])a.get()) : Objects.hashCode(a.get()))
|
||||
: 31;
|
||||
return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -243,7 +243,7 @@ public class Drawing {
|
||||
}
|
||||
|
||||
private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b) {
|
||||
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && a.get().getClass().isArray() ? Arrays.equals((T[])a.get(), (T[])b.get()) : Objects.equals(a.get(), b.get()));
|
||||
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -255,9 +255,7 @@ public class Drawing {
|
||||
if (a == null) {
|
||||
return 1;
|
||||
}
|
||||
return a.isPresent()
|
||||
? (a.get().getClass().isArray() ? Arrays.hashCode((T[])a.get()) : Objects.hashCode(a.get()))
|
||||
: 31;
|
||||
return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -525,7 +525,7 @@ public class EnumTest {
|
||||
}
|
||||
|
||||
private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b) {
|
||||
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && a.get().getClass().isArray() ? Arrays.equals((T[])a.get(), (T[])b.get()) : Objects.equals(a.get(), b.get()));
|
||||
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -537,9 +537,7 @@ public class EnumTest {
|
||||
if (a == null) {
|
||||
return 1;
|
||||
}
|
||||
return a.isPresent()
|
||||
? (a.get().getClass().isArray() ? Arrays.hashCode((T[])a.get()) : Objects.hashCode(a.get()))
|
||||
: 31;
|
||||
return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -95,7 +95,7 @@ public class HealthCheckResult {
|
||||
}
|
||||
|
||||
private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b) {
|
||||
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && a.get().getClass().isArray() ? Arrays.equals((T[])a.get(), (T[])b.get()) : Objects.equals(a.get(), b.get()));
|
||||
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -107,9 +107,7 @@ public class HealthCheckResult {
|
||||
if (a == null) {
|
||||
return 1;
|
||||
}
|
||||
return a.isPresent()
|
||||
? (a.get().getClass().isArray() ? Arrays.hashCode((T[])a.get()) : Objects.hashCode(a.get()))
|
||||
: 31;
|
||||
return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -620,7 +620,7 @@ public class NullableClass {
|
||||
}
|
||||
|
||||
private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b) {
|
||||
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && a.get().getClass().isArray() ? Arrays.equals((T[])a.get(), (T[])b.get()) : Objects.equals(a.get(), b.get()));
|
||||
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -632,9 +632,7 @@ public class NullableClass {
|
||||
if (a == null) {
|
||||
return 1;
|
||||
}
|
||||
return a.isPresent()
|
||||
? (a.get().getClass().isArray() ? Arrays.hashCode((T[])a.get()) : Objects.hashCode(a.get()))
|
||||
: 31;
|
||||
return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -451,7 +451,7 @@ public class User {
|
||||
}
|
||||
|
||||
private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b) {
|
||||
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && a.get().getClass().isArray() ? Arrays.equals((T[])a.get(), (T[])b.get()) : Objects.equals(a.get(), b.get()));
|
||||
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -463,9 +463,7 @@ public class User {
|
||||
if (a == null) {
|
||||
return 1;
|
||||
}
|
||||
return a.isPresent()
|
||||
? (a.get().getClass().isArray() ? Arrays.hashCode((T[])a.get()) : Objects.hashCode(a.get()))
|
||||
: 31;
|
||||
return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user