Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,6 @@ public int hashCode() {
* @return true if it's nullable
*/
public Boolean isNullable() {
if (Boolean.TRUE.equals(isNullable)) {
return Boolean.TRUE;
} else {
return Boolean.FALSE;
}
return Boolean.TRUE.equals(isNullable);
}
}
14 changes: 6 additions & 8 deletions src/main/java/com/adyen/model/acswebhooks/JSON.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import com.adyen.serializer.ByteArraySerializer;
import com.fasterxml.jackson.annotation.*;
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.json.JsonMapper;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import jakarta.ws.rs.core.GenericType;
Expand All @@ -18,10 +17,10 @@
public class JSON implements ContextResolver<ObjectMapper> {
private static ObjectMapper mapper;

public JSON() {
private JSON() {
mapper = new ObjectMapper();
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
JsonMapper.builder().configure(MapperFeature.ALLOW_COERCION_OF_SCALARS, false);
mapper.configure(MapperFeature.ALLOW_COERCION_OF_SCALARS, true);
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
mapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, true);
mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
Expand Down Expand Up @@ -69,7 +68,7 @@ public static ObjectMapper getMapper() {
public static Class<?> getClassForElement(JsonNode node, Class<?> modelClass) {
ClassDiscriminatorMapping cdm = modelDiscriminators.get(modelClass);
if (cdm != null) {
return cdm.getClassForElement(node, new HashSet<Class<?>>());
return cdm.getClassForElement(node, new HashSet<>());
}
return null;
}
Expand All @@ -87,7 +86,7 @@ private static class ClassDiscriminatorMapping {
ClassDiscriminatorMapping(Class<?> cls, String propertyName, Map<String, Class<?>> mappings) {
modelClass = cls;
discriminatorName = propertyName;
discriminatorMappings = new HashMap<String, Class<?>>();
discriminatorMappings = new HashMap<>();
if (mappings != null) {
discriminatorMappings.putAll(mappings);
}
Expand Down Expand Up @@ -195,12 +194,11 @@ public static boolean isInstanceOf(
}

/** A map of discriminators for all model classes. */
private static Map<Class<?>, ClassDiscriminatorMapping> modelDiscriminators =
private static final Map<Class<?>, ClassDiscriminatorMapping> modelDiscriminators =
new HashMap<Class<?>, ClassDiscriminatorMapping>();

/** A map of oneOf/anyOf descendants for each model class. */
private static Map<Class<?>, Map<String, GenericType>> modelDescendants =
new HashMap<Class<?>, Map<String, GenericType>>();
private static final Map<Class<?>, Map<String, GenericType>> modelDescendants = new HashMap<>();

/**
* Register a model class discriminator.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,6 @@ public int hashCode() {
* @return true if it's nullable
*/
public Boolean isNullable() {
if (Boolean.TRUE.equals(isNullable)) {
return Boolean.TRUE;
} else {
return Boolean.FALSE;
}
return Boolean.TRUE.equals(isNullable);
}
}
14 changes: 6 additions & 8 deletions src/main/java/com/adyen/model/balancecontrol/JSON.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import com.adyen.serializer.ByteArraySerializer;
import com.fasterxml.jackson.annotation.*;
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.json.JsonMapper;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import jakarta.ws.rs.core.GenericType;
Expand All @@ -18,10 +17,10 @@
public class JSON implements ContextResolver<ObjectMapper> {
private static ObjectMapper mapper;

public JSON() {
private JSON() {
mapper = new ObjectMapper();
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
JsonMapper.builder().configure(MapperFeature.ALLOW_COERCION_OF_SCALARS, false);
mapper.configure(MapperFeature.ALLOW_COERCION_OF_SCALARS, true);
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
mapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, true);
mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
Expand Down Expand Up @@ -69,7 +68,7 @@ public static ObjectMapper getMapper() {
public static Class<?> getClassForElement(JsonNode node, Class<?> modelClass) {
ClassDiscriminatorMapping cdm = modelDiscriminators.get(modelClass);
if (cdm != null) {
return cdm.getClassForElement(node, new HashSet<Class<?>>());
return cdm.getClassForElement(node, new HashSet<>());
}
return null;
}
Expand All @@ -87,7 +86,7 @@ private static class ClassDiscriminatorMapping {
ClassDiscriminatorMapping(Class<?> cls, String propertyName, Map<String, Class<?>> mappings) {
modelClass = cls;
discriminatorName = propertyName;
discriminatorMappings = new HashMap<String, Class<?>>();
discriminatorMappings = new HashMap<>();
if (mappings != null) {
discriminatorMappings.putAll(mappings);
}
Expand Down Expand Up @@ -195,12 +194,11 @@ public static boolean isInstanceOf(
}

/** A map of discriminators for all model classes. */
private static Map<Class<?>, ClassDiscriminatorMapping> modelDiscriminators =
private static final Map<Class<?>, ClassDiscriminatorMapping> modelDiscriminators =
new HashMap<Class<?>, ClassDiscriminatorMapping>();

/** A map of oneOf/anyOf descendants for each model class. */
private static Map<Class<?>, Map<String, GenericType>> modelDescendants =
new HashMap<Class<?>, Map<String, GenericType>>();
private static final Map<Class<?>, Map<String, GenericType>> modelDescendants = new HashMap<>();

/**
* Register a model class discriminator.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,6 @@ public int hashCode() {
* @return true if it's nullable
*/
public Boolean isNullable() {
if (Boolean.TRUE.equals(isNullable)) {
return Boolean.TRUE;
} else {
return Boolean.FALSE;
}
return Boolean.TRUE.equals(isNullable);
}
}
14 changes: 6 additions & 8 deletions src/main/java/com/adyen/model/balanceplatform/JSON.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import com.adyen.serializer.ByteArraySerializer;
import com.fasterxml.jackson.annotation.*;
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.json.JsonMapper;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import jakarta.ws.rs.core.GenericType;
Expand All @@ -18,10 +17,10 @@
public class JSON implements ContextResolver<ObjectMapper> {
private static ObjectMapper mapper;

public JSON() {
private JSON() {
mapper = new ObjectMapper();
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
JsonMapper.builder().configure(MapperFeature.ALLOW_COERCION_OF_SCALARS, false);
mapper.configure(MapperFeature.ALLOW_COERCION_OF_SCALARS, true);
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
mapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, true);
mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
Expand Down Expand Up @@ -69,7 +68,7 @@ public static ObjectMapper getMapper() {
public static Class<?> getClassForElement(JsonNode node, Class<?> modelClass) {
ClassDiscriminatorMapping cdm = modelDiscriminators.get(modelClass);
if (cdm != null) {
return cdm.getClassForElement(node, new HashSet<Class<?>>());
return cdm.getClassForElement(node, new HashSet<>());
}
return null;
}
Expand All @@ -87,7 +86,7 @@ private static class ClassDiscriminatorMapping {
ClassDiscriminatorMapping(Class<?> cls, String propertyName, Map<String, Class<?>> mappings) {
modelClass = cls;
discriminatorName = propertyName;
discriminatorMappings = new HashMap<String, Class<?>>();
discriminatorMappings = new HashMap<>();
if (mappings != null) {
discriminatorMappings.putAll(mappings);
}
Expand Down Expand Up @@ -195,12 +194,11 @@ public static boolean isInstanceOf(
}

/** A map of discriminators for all model classes. */
private static Map<Class<?>, ClassDiscriminatorMapping> modelDiscriminators =
private static final Map<Class<?>, ClassDiscriminatorMapping> modelDiscriminators =
new HashMap<Class<?>, ClassDiscriminatorMapping>();

/** A map of oneOf/anyOf descendants for each model class. */
private static Map<Class<?>, Map<String, GenericType>> modelDescendants =
new HashMap<Class<?>, Map<String, GenericType>>();
private static final Map<Class<?>, Map<String, GenericType>> modelDescendants = new HashMap<>();

/**
* Register a model class discriminator.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,6 @@ public int hashCode() {
* @return true if it's nullable
*/
public Boolean isNullable() {
if (Boolean.TRUE.equals(isNullable)) {
return Boolean.TRUE;
} else {
return Boolean.FALSE;
}
return Boolean.TRUE.equals(isNullable);
}
}
14 changes: 6 additions & 8 deletions src/main/java/com/adyen/model/balancewebhooks/JSON.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import com.adyen.serializer.ByteArraySerializer;
import com.fasterxml.jackson.annotation.*;
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.json.JsonMapper;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import jakarta.ws.rs.core.GenericType;
Expand All @@ -18,10 +17,10 @@
public class JSON implements ContextResolver<ObjectMapper> {
private static ObjectMapper mapper;

public JSON() {
private JSON() {
mapper = new ObjectMapper();
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
JsonMapper.builder().configure(MapperFeature.ALLOW_COERCION_OF_SCALARS, false);
mapper.configure(MapperFeature.ALLOW_COERCION_OF_SCALARS, true);
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
mapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, true);
mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
Expand Down Expand Up @@ -69,7 +68,7 @@ public static ObjectMapper getMapper() {
public static Class<?> getClassForElement(JsonNode node, Class<?> modelClass) {
ClassDiscriminatorMapping cdm = modelDiscriminators.get(modelClass);
if (cdm != null) {
return cdm.getClassForElement(node, new HashSet<Class<?>>());
return cdm.getClassForElement(node, new HashSet<>());
}
return null;
}
Expand All @@ -87,7 +86,7 @@ private static class ClassDiscriminatorMapping {
ClassDiscriminatorMapping(Class<?> cls, String propertyName, Map<String, Class<?>> mappings) {
modelClass = cls;
discriminatorName = propertyName;
discriminatorMappings = new HashMap<String, Class<?>>();
discriminatorMappings = new HashMap<>();
if (mappings != null) {
discriminatorMappings.putAll(mappings);
}
Expand Down Expand Up @@ -195,12 +194,11 @@ public static boolean isInstanceOf(
}

/** A map of discriminators for all model classes. */
private static Map<Class<?>, ClassDiscriminatorMapping> modelDiscriminators =
private static final Map<Class<?>, ClassDiscriminatorMapping> modelDiscriminators =
new HashMap<Class<?>, ClassDiscriminatorMapping>();

/** A map of oneOf/anyOf descendants for each model class. */
private static Map<Class<?>, Map<String, GenericType>> modelDescendants =
new HashMap<Class<?>, Map<String, GenericType>>();
private static final Map<Class<?>, Map<String, GenericType>> modelDescendants = new HashMap<>();

/**
* Register a model class discriminator.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,6 @@ public int hashCode() {
* @return true if it's nullable
*/
public Boolean isNullable() {
if (Boolean.TRUE.equals(isNullable)) {
return Boolean.TRUE;
} else {
return Boolean.FALSE;
}
return Boolean.TRUE.equals(isNullable);
}
}
14 changes: 6 additions & 8 deletions src/main/java/com/adyen/model/binlookup/JSON.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import com.adyen.serializer.ByteArraySerializer;
import com.fasterxml.jackson.annotation.*;
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.json.JsonMapper;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import jakarta.ws.rs.core.GenericType;
Expand All @@ -18,10 +17,10 @@
public class JSON implements ContextResolver<ObjectMapper> {
private static ObjectMapper mapper;

public JSON() {
private JSON() {
mapper = new ObjectMapper();
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
JsonMapper.builder().configure(MapperFeature.ALLOW_COERCION_OF_SCALARS, false);
mapper.configure(MapperFeature.ALLOW_COERCION_OF_SCALARS, true);
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
mapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, true);
mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
Expand Down Expand Up @@ -69,7 +68,7 @@ public static ObjectMapper getMapper() {
public static Class<?> getClassForElement(JsonNode node, Class<?> modelClass) {
ClassDiscriminatorMapping cdm = modelDiscriminators.get(modelClass);
if (cdm != null) {
return cdm.getClassForElement(node, new HashSet<Class<?>>());
return cdm.getClassForElement(node, new HashSet<>());
}
return null;
}
Expand All @@ -87,7 +86,7 @@ private static class ClassDiscriminatorMapping {
ClassDiscriminatorMapping(Class<?> cls, String propertyName, Map<String, Class<?>> mappings) {
modelClass = cls;
discriminatorName = propertyName;
discriminatorMappings = new HashMap<String, Class<?>>();
discriminatorMappings = new HashMap<>();
if (mappings != null) {
discriminatorMappings.putAll(mappings);
}
Expand Down Expand Up @@ -195,12 +194,11 @@ public static boolean isInstanceOf(
}

/** A map of discriminators for all model classes. */
private static Map<Class<?>, ClassDiscriminatorMapping> modelDiscriminators =
private static final Map<Class<?>, ClassDiscriminatorMapping> modelDiscriminators =
new HashMap<Class<?>, ClassDiscriminatorMapping>();

/** A map of oneOf/anyOf descendants for each model class. */
private static Map<Class<?>, Map<String, GenericType>> modelDescendants =
new HashMap<Class<?>, Map<String, GenericType>>();
private static final Map<Class<?>, Map<String, GenericType>> modelDescendants = new HashMap<>();

/**
* Register a model class discriminator.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,6 @@ public int hashCode() {
* @return true if it's nullable
*/
public Boolean isNullable() {
if (Boolean.TRUE.equals(isNullable)) {
return Boolean.TRUE;
} else {
return Boolean.FALSE;
}
return Boolean.TRUE.equals(isNullable);
}
}
14 changes: 6 additions & 8 deletions src/main/java/com/adyen/model/checkout/JSON.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import com.adyen.serializer.ByteArraySerializer;
import com.fasterxml.jackson.annotation.*;
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.json.JsonMapper;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import jakarta.ws.rs.core.GenericType;
Expand All @@ -18,10 +17,10 @@
public class JSON implements ContextResolver<ObjectMapper> {
private static ObjectMapper mapper;

public JSON() {
private JSON() {
mapper = new ObjectMapper();
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
JsonMapper.builder().configure(MapperFeature.ALLOW_COERCION_OF_SCALARS, false);
mapper.configure(MapperFeature.ALLOW_COERCION_OF_SCALARS, true);
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
mapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, true);
mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
Expand Down Expand Up @@ -69,7 +68,7 @@ public static ObjectMapper getMapper() {
public static Class<?> getClassForElement(JsonNode node, Class<?> modelClass) {
ClassDiscriminatorMapping cdm = modelDiscriminators.get(modelClass);
if (cdm != null) {
return cdm.getClassForElement(node, new HashSet<Class<?>>());
return cdm.getClassForElement(node, new HashSet<>());
}
return null;
}
Expand All @@ -87,7 +86,7 @@ private static class ClassDiscriminatorMapping {
ClassDiscriminatorMapping(Class<?> cls, String propertyName, Map<String, Class<?>> mappings) {
modelClass = cls;
discriminatorName = propertyName;
discriminatorMappings = new HashMap<String, Class<?>>();
discriminatorMappings = new HashMap<>();
if (mappings != null) {
discriminatorMappings.putAll(mappings);
}
Expand Down Expand Up @@ -195,12 +194,11 @@ public static boolean isInstanceOf(
}

/** A map of discriminators for all model classes. */
private static Map<Class<?>, ClassDiscriminatorMapping> modelDiscriminators =
private static final Map<Class<?>, ClassDiscriminatorMapping> modelDiscriminators =
new HashMap<Class<?>, ClassDiscriminatorMapping>();

/** A map of oneOf/anyOf descendants for each model class. */
private static Map<Class<?>, Map<String, GenericType>> modelDescendants =
new HashMap<Class<?>, Map<String, GenericType>>();
private static final Map<Class<?>, Map<String, GenericType>> modelDescendants = new HashMap<>();

/**
* Register a model class discriminator.
Expand Down
Loading