I'm trying to represent an international address in a class object using MapStruct that maps it from a PDF form.
The address will have a country, if this country is America then the address must have a state. If the country is not America then the address must have a province. I have separate variables for state and province, but want to map something like:
@Mapping(target="userCountry", source="Form_User_Country")
@Mapping(target="userState", source="Form_User_State_or_Province")
@Mapping(target="userProvince", source="Form_User_State_or_Province")
The state or province of the user is represented by one field in the form, but two separate variables in the DTO.
How can I make it so if Form_User_Country="USA", then the comments of Form_User_State_or_Province map to userState, but to map the contents to userProvince instead if the Form_User_Country!="USA"?