modelmapper abstract class

Solutions on MaxInterview for modelmapper abstract class by the best coders in the world

showing results for - "modelmapper abstract class"
Anushka
14 Mar 2016
1public void configure(ModelMapper modelMapper) {
2    modelMapper.typeMap(QuestionDto.class, AbstractItem.class)
3            .setConverter(converterWithDestinationSupplier(Question::new));
4    modelMapper.typeMap(CriteriaDto.class, AbstractItem.class)
5            .setConverter(converterWithDestinationSupplier(Criteria::new));
6}
7
8private <S, D> Converter<S, D> converterWithDestinationSupplier(Supplier<? extends D> supplier ) {
9    return ctx -> ctx.getMappingEngine().map(ctx.create(ctx.getSource(), supplier.get()));
10}
11