📜  带有页面的模型映射器 - Java 代码示例

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

代码示例1
/**
 * Maps the Page {@code entities} of T type which have to be mapped as input to {@code dtoClass} Page
 * of mapped object with D type.
 *
 * @param  - type of objects in result page
 * @param  - type of entity in entityPage
 * @param entities - page of entities that needs to be mapped
 * @param dtoClass - class of result page element
 * @return page - mapped page with objects of type D.
 * @NB dtoClass must has NoArgsConstructor!
 */
public  Page mapEntityPageIntoDtoPage(Page entities, Class dtoClass) {
    return entities.map(objectEntity -> modelMapper.map(objectEntity, dtoClass));
}