I am using ModelMapper for Java, and it's a nifty, simple tool for doing Domain Object -> DTO mapping.
Let's say I have a DTO like this:
public class TestDTO { List<QuestionDTO> questions; // gettings and setters }
With ModelMapper, I am trying to map a Test
object that contains a List<Question>
to TestDTO
.
The Question
class in the Test
class is abstract, so the individual instances in the list will be subclasses, such as ShortAnswerQuestion
or MultipleChoiceQuestion
.
How can I tell ModelMapper to create DTO's of types ShortAnswerQuestionDTO
and MultipleChoiceQuestionDTO
? By Default, ModelMapper is mapping them to QuestionDTO
, since the list is defined that way... but that's not what I want.
Thanks!
--
You received this message because you are subscribed to the Google Groups "modelmapper" group.
To unsubscribe from this group and stop receiving emails from it, send an email to modelmapper...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.