How to use modelMapper to convert nested classes
<p>I have a simple class that I want to map to a DTO class using modelMapper.</p>

<pre><code>class Source {

    private String name;
    private String address;
    List&lt;Thing&gt; things;

    // getters and setters follows
    }

    class Thing {

    private String thingCode;
    private String thingDescription;

    // getters and setters
}
</code></pre>

<p>and I want to convert these to a sourceDTO that contains a list of ThingDTOs, for example</p>

<pre><code>class sourceDTO {

    private String name;
    private String address;
    List&lt;ThingDTO&gt; things;

    // getters and setters.
    }

     class ThingDTO {

    private String thingCode;
    private String thingDescription;

    // getters and setters
}
</code></pre>

<p>If I drop my list of Things and list of ThingsDTO then modelmapper is a delight to use, </p>

<pre><code> modelMapper.map(source, SourceDTO.class);
</code></pre>

<p>But I can't work out how to get the mapper to convert the List of Things to List of ThingDTOs. From the documentation, I think I need to create a mapper class that extends PropertyMap but I can't work out how to configure it.</p>

<p>Any pointers to the relevant documentation would be welcome</p>