I want to map the fields of two java objects based on condition like below.
if(sourceObject.getField1() != null && targetObject.getField1() == null){
targetObject.setFields1(sourceObject.getField1())
}
I am using mapstruct @MappingTarget annotation but it is not giving me what I am expecting like above. I have multiple classes/subclasses with a hundred fields. Any suggestions or examples will help.