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 @@ -11,7 +11,9 @@

package com.adyen.model.transfers;

import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
Expand All @@ -31,9 +33,15 @@ public class AULocalAccountIdentification {
public static final String JSON_PROPERTY_ACCOUNT_NUMBER = "accountNumber";
private String accountNumber;

/** Mark when the attribute has been explicitly set. */
private boolean isSetAccountNumber = false;

public static final String JSON_PROPERTY_BSB_CODE = "bsbCode";
private String bsbCode;

/** Mark when the attribute has been explicitly set. */
private boolean isSetBsbCode = false;

/** **auLocal** */
public enum TypeEnum {
AULOCAL(String.valueOf("auLocal"));
Expand Down Expand Up @@ -76,6 +84,15 @@ public static TypeEnum fromValue(String value) {
public static final String JSON_PROPERTY_TYPE = "type";
private TypeEnum type;

/** Mark when the attribute has been explicitly set. */
private boolean isSetType = false;

/**
* Sets whether attributes with null values should be explicitly included in the JSON payload.
* Default is false.
*/
@JsonIgnore private boolean includeNullValues = false;

public AULocalAccountIdentification() {}

/**
Expand All @@ -86,6 +103,7 @@ public AULocalAccountIdentification() {}
*/
public AULocalAccountIdentification accountNumber(String accountNumber) {
this.accountNumber = accountNumber;
isSetAccountNumber = true; // mark as set
return this;
}

Expand All @@ -109,6 +127,7 @@ public String getAccountNumber() {
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setAccountNumber(String accountNumber) {
this.accountNumber = accountNumber;
isSetAccountNumber = true; // mark as set
}

/**
Expand All @@ -121,6 +140,7 @@ public void setAccountNumber(String accountNumber) {
*/
public AULocalAccountIdentification bsbCode(String bsbCode) {
this.bsbCode = bsbCode;
isSetBsbCode = true; // mark as set
return this;
}

Expand Down Expand Up @@ -148,6 +168,7 @@ public String getBsbCode() {
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setBsbCode(String bsbCode) {
this.bsbCode = bsbCode;
isSetBsbCode = true; // mark as set
}

/**
Expand All @@ -158,6 +179,7 @@ public void setBsbCode(String bsbCode) {
*/
public AULocalAccountIdentification type(TypeEnum type) {
this.type = type;
isSetType = true; // mark as set
return this;
}

Expand All @@ -181,6 +203,27 @@ public TypeEnum getType() {
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setType(TypeEnum type) {
this.type = type;
isSetType = true; // mark as set
}

/**
* Configures whether null values are explicitly serialized in the JSON payload. Default is false.
*/
public AULocalAccountIdentification includeNullValues(boolean includeNullValues) {
this.includeNullValues = includeNullValues;
return this;
}

/** Returns whether null values are explicitly serialized in the JSON payload. */
public boolean isIncludeNullValues() {
return includeNullValues;
}

/**
* Sets whether null values should be explicitly serialized in the JSON payload. Default is false.
*/
public void setIncludeNullValues(boolean includeNullValues) {
this.includeNullValues = includeNullValues;
}

/** Return true if this AULocalAccountIdentification object is equal to o. */
Expand All @@ -194,13 +237,16 @@ public boolean equals(Object o) {
}
AULocalAccountIdentification auLocalAccountIdentification = (AULocalAccountIdentification) o;
return Objects.equals(this.accountNumber, auLocalAccountIdentification.accountNumber)
&& Objects.equals(this.isSetAccountNumber, auLocalAccountIdentification.isSetAccountNumber)
&& Objects.equals(this.bsbCode, auLocalAccountIdentification.bsbCode)
&& Objects.equals(this.type, auLocalAccountIdentification.type);
&& Objects.equals(this.isSetBsbCode, auLocalAccountIdentification.isSetBsbCode)
&& Objects.equals(this.type, auLocalAccountIdentification.type)
&& Objects.equals(this.isSetType, auLocalAccountIdentification.isSetType);
}

@Override
public int hashCode() {
return Objects.hash(accountNumber, bsbCode, type);
return Objects.hash(accountNumber, isSetAccountNumber, bsbCode, isSetBsbCode, type, isSetType);
}

@Override
Expand All @@ -224,6 +270,36 @@ private String toIndentedString(Object o) {
return o.toString().replace("\n", "\n ");
}

/** Returns a map of properties to be merged into the JSON payload as explicit null values. */
@JsonInclude(JsonInclude.Include.ALWAYS)
@JsonAnyGetter
public Map<String, Object> getExplicitNulls() {
if (!this.includeNullValues) {
return Collections.emptyMap();
}

Map<String, Object> nulls = new HashMap<>();

if (isSetAccountNumber) {
addIfNull(nulls, JSON_PROPERTY_ACCOUNT_NUMBER, this.accountNumber);
}
if (isSetBsbCode) {
addIfNull(nulls, JSON_PROPERTY_BSB_CODE, this.bsbCode);
}
if (isSetType) {
addIfNull(nulls, JSON_PROPERTY_TYPE, this.type);
}

return nulls;
}

// add to map when value is null
private void addIfNull(Map<String, Object> map, String key, Object value) {
if (value == null) {
map.put(key, null);
}
}

/**
* Create an instance of AULocalAccountIdentification given an JSON string
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@

package com.adyen.model.transfers;

import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
Expand All @@ -30,6 +32,9 @@ public class AdditionalBankIdentification {
public static final String JSON_PROPERTY_CODE = "code";
private String code;

/** Mark when the attribute has been explicitly set. */
private boolean isSetCode = false;

/**
* The type of additional bank identification, depending on the country. Possible values: *
* **auBsbCode**: The 6-digit [Australian Bank State Branch (BSB)
Expand Down Expand Up @@ -89,6 +94,15 @@ public static TypeEnum fromValue(String value) {
public static final String JSON_PROPERTY_TYPE = "type";
private TypeEnum type;

/** Mark when the attribute has been explicitly set. */
private boolean isSetType = false;

/**
* Sets whether attributes with null values should be explicitly included in the JSON payload.
* Default is false.
*/
@JsonIgnore private boolean includeNullValues = false;

public AdditionalBankIdentification() {}

/**
Expand All @@ -99,6 +113,7 @@ public AdditionalBankIdentification() {}
*/
public AdditionalBankIdentification code(String code) {
this.code = code;
isSetCode = true; // mark as set
return this;
}

Expand All @@ -122,6 +137,7 @@ public String getCode() {
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setCode(String code) {
this.code = code;
isSetCode = true; // mark as set
}

/**
Expand Down Expand Up @@ -150,6 +166,7 @@ public void setCode(String code) {
*/
public AdditionalBankIdentification type(TypeEnum type) {
this.type = type;
isSetType = true; // mark as set
return this;
}

Expand Down Expand Up @@ -209,6 +226,27 @@ public TypeEnum getType() {
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setType(TypeEnum type) {
this.type = type;
isSetType = true; // mark as set
}

/**
* Configures whether null values are explicitly serialized in the JSON payload. Default is false.
*/
public AdditionalBankIdentification includeNullValues(boolean includeNullValues) {
this.includeNullValues = includeNullValues;
return this;
}

/** Returns whether null values are explicitly serialized in the JSON payload. */
public boolean isIncludeNullValues() {
return includeNullValues;
}

/**
* Sets whether null values should be explicitly serialized in the JSON payload. Default is false.
*/
public void setIncludeNullValues(boolean includeNullValues) {
this.includeNullValues = includeNullValues;
}

/** Return true if this AdditionalBankIdentification object is equal to o. */
Expand All @@ -222,12 +260,14 @@ public boolean equals(Object o) {
}
AdditionalBankIdentification additionalBankIdentification = (AdditionalBankIdentification) o;
return Objects.equals(this.code, additionalBankIdentification.code)
&& Objects.equals(this.type, additionalBankIdentification.type);
&& Objects.equals(this.isSetCode, additionalBankIdentification.isSetCode)
&& Objects.equals(this.type, additionalBankIdentification.type)
&& Objects.equals(this.isSetType, additionalBankIdentification.isSetType);
}

@Override
public int hashCode() {
return Objects.hash(code, type);
return Objects.hash(code, isSetCode, type, isSetType);
}

@Override
Expand All @@ -250,6 +290,33 @@ private String toIndentedString(Object o) {
return o.toString().replace("\n", "\n ");
}

/** Returns a map of properties to be merged into the JSON payload as explicit null values. */
@JsonInclude(JsonInclude.Include.ALWAYS)
@JsonAnyGetter
public Map<String, Object> getExplicitNulls() {
if (!this.includeNullValues) {
return Collections.emptyMap();
}

Map<String, Object> nulls = new HashMap<>();

if (isSetCode) {
addIfNull(nulls, JSON_PROPERTY_CODE, this.code);
}
if (isSetType) {
addIfNull(nulls, JSON_PROPERTY_TYPE, this.type);
}

return nulls;
}

// add to map when value is null
private void addIfNull(Map<String, Object> map, String key, Object value) {
if (value == null) {
map.put(key, null);
}
}

/**
* Create an instance of AdditionalBankIdentification given an JSON string
*
Expand Down
Loading