Passing multiple parameters using qualifiedByName or qualifiedBy for custom mappers

989 views
Skip to first unread message

Rahul Rao

unread,
Apr 9, 2019, 7:22:15 PM4/9/19
to mapstruct-users
I am trying to use qualifiedBy or qualifiedByName to convert a String to EncryptedValue type. The encrypted value takes a cryptoId based on the source string I am encrypting, example: date of birth has a birthIdentifier and that string is used for encryption.

@Mapping(target = "dob", source = "dob", qualifiedBy = EncryptedValueMapper.mapToEncryptedValueDob.class)
PrimaryUserInfoDto mapPrimaryUserInfoDTOToPersistence(PrimaryUserInfoDTO primaryUserInfoDTO);


Can I pass the BirthIdentifier to my custom mapper class though this mapper? Right now I have separate methods for different encryptions and it's not a very clean. Is there something better?


Thanks,

Rahul Rao



Reply all
Reply to author
Forward
0 new messages