1111
1212package com .adyen .model .transfers ;
1313
14+ import com .fasterxml .jackson .annotation .JsonAnyGetter ;
1415import com .fasterxml .jackson .annotation .JsonCreator ;
16+ import com .fasterxml .jackson .annotation .JsonIgnore ;
1517import com .fasterxml .jackson .annotation .JsonInclude ;
1618import com .fasterxml .jackson .annotation .JsonProperty ;
1719import com .fasterxml .jackson .annotation .JsonPropertyOrder ;
@@ -31,9 +33,15 @@ public class AULocalAccountIdentification {
3133 public static final String JSON_PROPERTY_ACCOUNT_NUMBER = "accountNumber" ;
3234 private String accountNumber ;
3335
36+ /** Mark when the attribute has been explicitly set. */
37+ private boolean isSetAccountNumber = false ;
38+
3439 public static final String JSON_PROPERTY_BSB_CODE = "bsbCode" ;
3540 private String bsbCode ;
3641
42+ /** Mark when the attribute has been explicitly set. */
43+ private boolean isSetBsbCode = false ;
44+
3745 /** **auLocal** */
3846 public enum TypeEnum {
3947 AULOCAL (String .valueOf ("auLocal" ));
@@ -76,6 +84,15 @@ public static TypeEnum fromValue(String value) {
7684 public static final String JSON_PROPERTY_TYPE = "type" ;
7785 private TypeEnum type ;
7886
87+ /** Mark when the attribute has been explicitly set. */
88+ private boolean isSetType = false ;
89+
90+ /**
91+ * Sets whether attributes with null values should be explicitly included in the JSON payload.
92+ * Default is false.
93+ */
94+ @ JsonIgnore private boolean includeNullValues = false ;
95+
7996 public AULocalAccountIdentification () {}
8097
8198 /**
@@ -86,6 +103,7 @@ public AULocalAccountIdentification() {}
86103 */
87104 public AULocalAccountIdentification accountNumber (String accountNumber ) {
88105 this .accountNumber = accountNumber ;
106+ isSetAccountNumber = true ; // mark as set
89107 return this ;
90108 }
91109
@@ -109,6 +127,7 @@ public String getAccountNumber() {
109127 @ JsonInclude (value = JsonInclude .Include .USE_DEFAULTS )
110128 public void setAccountNumber (String accountNumber ) {
111129 this .accountNumber = accountNumber ;
130+ isSetAccountNumber = true ; // mark as set
112131 }
113132
114133 /**
@@ -121,6 +140,7 @@ public void setAccountNumber(String accountNumber) {
121140 */
122141 public AULocalAccountIdentification bsbCode (String bsbCode ) {
123142 this .bsbCode = bsbCode ;
143+ isSetBsbCode = true ; // mark as set
124144 return this ;
125145 }
126146
@@ -148,6 +168,7 @@ public String getBsbCode() {
148168 @ JsonInclude (value = JsonInclude .Include .USE_DEFAULTS )
149169 public void setBsbCode (String bsbCode ) {
150170 this .bsbCode = bsbCode ;
171+ isSetBsbCode = true ; // mark as set
151172 }
152173
153174 /**
@@ -158,6 +179,7 @@ public void setBsbCode(String bsbCode) {
158179 */
159180 public AULocalAccountIdentification type (TypeEnum type ) {
160181 this .type = type ;
182+ isSetType = true ; // mark as set
161183 return this ;
162184 }
163185
@@ -181,6 +203,27 @@ public TypeEnum getType() {
181203 @ JsonInclude (value = JsonInclude .Include .USE_DEFAULTS )
182204 public void setType (TypeEnum type ) {
183205 this .type = type ;
206+ isSetType = true ; // mark as set
207+ }
208+
209+ /**
210+ * Configures whether null values are explicitly serialized in the JSON payload. Default is false.
211+ */
212+ public AULocalAccountIdentification includeNullValues (boolean includeNullValues ) {
213+ this .includeNullValues = includeNullValues ;
214+ return this ;
215+ }
216+
217+ /** Returns whether null values are explicitly serialized in the JSON payload. */
218+ public boolean isIncludeNullValues () {
219+ return includeNullValues ;
220+ }
221+
222+ /**
223+ * Sets whether null values should be explicitly serialized in the JSON payload. Default is false.
224+ */
225+ public void setIncludeNullValues (boolean includeNullValues ) {
226+ this .includeNullValues = includeNullValues ;
184227 }
185228
186229 /** Return true if this AULocalAccountIdentification object is equal to o. */
@@ -194,13 +237,16 @@ public boolean equals(Object o) {
194237 }
195238 AULocalAccountIdentification auLocalAccountIdentification = (AULocalAccountIdentification ) o ;
196239 return Objects .equals (this .accountNumber , auLocalAccountIdentification .accountNumber )
240+ && Objects .equals (this .isSetAccountNumber , auLocalAccountIdentification .isSetAccountNumber )
197241 && Objects .equals (this .bsbCode , auLocalAccountIdentification .bsbCode )
198- && Objects .equals (this .type , auLocalAccountIdentification .type );
242+ && Objects .equals (this .isSetBsbCode , auLocalAccountIdentification .isSetBsbCode )
243+ && Objects .equals (this .type , auLocalAccountIdentification .type )
244+ && Objects .equals (this .isSetType , auLocalAccountIdentification .isSetType );
199245 }
200246
201247 @ Override
202248 public int hashCode () {
203- return Objects .hash (accountNumber , bsbCode , type );
249+ return Objects .hash (accountNumber , isSetAccountNumber , bsbCode , isSetBsbCode , type , isSetType );
204250 }
205251
206252 @ Override
@@ -224,6 +270,36 @@ private String toIndentedString(Object o) {
224270 return o .toString ().replace ("\n " , "\n " );
225271 }
226272
273+ /** Returns a map of properties to be merged into the JSON payload as explicit null values. */
274+ @ JsonInclude (JsonInclude .Include .ALWAYS )
275+ @ JsonAnyGetter
276+ public Map <String , Object > getExplicitNulls () {
277+ if (!this .includeNullValues ) {
278+ return Collections .emptyMap ();
279+ }
280+
281+ Map <String , Object > nulls = new HashMap <>();
282+
283+ if (isSetAccountNumber ) {
284+ addIfNull (nulls , JSON_PROPERTY_ACCOUNT_NUMBER , this .accountNumber );
285+ }
286+ if (isSetBsbCode ) {
287+ addIfNull (nulls , JSON_PROPERTY_BSB_CODE , this .bsbCode );
288+ }
289+ if (isSetType ) {
290+ addIfNull (nulls , JSON_PROPERTY_TYPE , this .type );
291+ }
292+
293+ return nulls ;
294+ }
295+
296+ // add to map when value is null
297+ private void addIfNull (Map <String , Object > map , String key , Object value ) {
298+ if (value == null ) {
299+ map .put (key , null );
300+ }
301+ }
302+
227303 /**
228304 * Create an instance of AULocalAccountIdentification given an JSON string
229305 *
0 commit comments