📜  modelmapper 抽象类 - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:23.532000             🧑  作者: Mango

代码示例1
public void configure(ModelMapper modelMapper) {
    modelMapper.typeMap(QuestionDto.class, AbstractItem.class)
            .setConverter(converterWithDestinationSupplier(Question::new));
    modelMapper.typeMap(CriteriaDto.class, AbstractItem.class)
            .setConverter(converterWithDestinationSupplier(Criteria::new));
}

private  Converter converterWithDestinationSupplier(Supplier supplier ) {
    return ctx -> ctx.getMappingEngine().map(ctx.create(ctx.getSource(), supplier.get()));
}