|
20 | 20 | * UnregisteredContactsParameter deserializedUnregisteredContacts = UnregisteredContactsParameter.fromJson(json);
|
21 | 21 | */
|
22 | 22 | @SuppressWarnings('PMD.FieldNamingConventions')
|
23 |
| -public class UnregisteredContactsParameter { |
| 23 | +public class UnregisteredContactsParameter implements IJsonSerializable { |
24 | 24 | /**
|
25 |
| - * @description Error messages for the `UnregisteredContactsParameter` class and the `ContactName` field. |
| 25 | + * @description Error messages for the `UnregisteredContactsParameter` class and the |
| 26 | + * `ContactName` field. |
26 | 27 | *
|
27 | 28 | * @author Kenneth Soerensen <[email protected]>, Nav
|
28 | 29 | * @since 0.1.0, January 2025
|
29 | 30 | */
|
30 | 31 | public static final String CONTACT_NAME_BLANK_ERROR_MESSAGE = 'The ContactName field is mandatory.';
|
31 | 32 | /**
|
32 |
| - * @description Error messages for the `UnregisteredContactsParameter` class and the `Role` field. |
| 33 | + * @description Error messages for the `UnregisteredContactsParameter` class and the `Role` |
| 34 | + * field. |
33 | 35 | *
|
34 | 36 | * @author Kenneth Soerensen <[email protected]>, Nav
|
35 | 37 | * @since 0.1.0, January 2025
|
36 | 38 | */
|
37 | 39 | public static final String ROLE_BLANK_ERROR_MESSAGE = 'The Role field is mandatory.';
|
38 | 40 | /**
|
39 |
| - * @description Error messages for the `UnregisteredContactsParameter` class and the `ContactName` and `Role` fields. |
| 41 | + * @description Error messages for the `UnregisteredContactsParameter` class and the |
| 42 | + * `ContactName` and `Role` fields. |
40 | 43 | *
|
41 | 44 | * @author Kenneth Soerensen <[email protected]>, Nav
|
42 | 45 | * @since 0.1.0, January 2025
|
@@ -457,12 +460,47 @@ public class UnregisteredContactsParameter {
|
457 | 460 | );
|
458 | 461 | }
|
459 | 462 |
|
| 463 | + /** |
| 464 | + * @description Deserializes a map into an `UnregisteredContactsParameter` object instance. |
| 465 | + * |
| 466 | + * @author Kenneth Soerensen <[email protected]>, Nav |
| 467 | + * @since 0.1.0, January 2025 |
| 468 | + * @param mapData The map to deserialize. |
| 469 | + * @return `UnregisteredContactsParameter` The deserialized object instance from the map. |
| 470 | + */ |
| 471 | + public static UnregisteredContactsParameter fromMap( |
| 472 | + Map<String, Object> mapData |
| 473 | + ) { |
| 474 | + UnregisteredContactsParameter unregisteredContacts = new UnregisteredContactsParameter(); |
| 475 | + unregisteredContacts.Role = (String) mapData.get('Role'); |
| 476 | + unregisteredContacts.IsUnofficial = (Boolean) mapData.get( |
| 477 | + 'IsUnofficial' |
| 478 | + ); |
| 479 | + unregisteredContacts.ContactName = (String) mapData.get('ContactName'); |
| 480 | + unregisteredContacts.ContactCompanyName = (String) mapData.get( |
| 481 | + 'ContactCompanyName' |
| 482 | + ); |
| 483 | + unregisteredContacts.ReferenceNumber = (String) mapData.get( |
| 484 | + 'ReferenceNumber' |
| 485 | + ); |
| 486 | + unregisteredContacts.Address = (String) mapData.get('Address'); |
| 487 | + unregisteredContacts.Country = (String) mapData.get('Country'); |
| 488 | + unregisteredContacts.MobilePhone = (String) mapData.get('MobilePhone'); |
| 489 | + unregisteredContacts.Phone = (String) mapData.get('Phone'); |
| 490 | + unregisteredContacts.Email = (String) mapData.get('Email'); |
| 491 | + unregisteredContacts.State = (String) mapData.get('State'); |
| 492 | + unregisteredContacts.ZipCode = (String) mapData.get('ZipCode'); |
| 493 | + unregisteredContacts.ZipPlace = (String) mapData.get('ZipPlace'); |
| 494 | + |
| 495 | + return unregisteredContacts; |
| 496 | + } |
| 497 | + |
460 | 498 | /**
|
461 | 499 | * @description Validates the object to ensuring it has the mandatory fields set.
|
462 | 500 | *
|
463 | 501 | * @author Kenneth Soerensen <[email protected]>, Nav
|
464 | 502 | * @since 0.1.0, January 2025
|
465 |
| - * @exception ContactParameterException |
| 503 | + * @exception UnregisteredContactsParameterException |
466 | 504 | */
|
467 | 505 | @TestVisible
|
468 | 506 | private void validate() {
|
|
0 commit comments