I am writing simple blog web application using Spring MVC framework. I am willing to add DTO
layer to my app.
I decided to use ModelMapper framework for con
considering you have a list of Post Entity (postEntityList
) and a PostDTO class, you can try following:
use the following imports to get the desired results
import org.modelmapper.ModelMapper;
import org.modelmapper.TypeToken;
import java.lang.reflect.Type;
use the below code
Type listType = new TypeToken>(){}.getType();
List postDtoList = modelmapper.map(postEntityList,listType);