@Builder를 이용한 DTO와 ENTITY 변환
TodoListInfo todoListInfo = todoService.readTodoListInfo(code);
ReadTodoListDto readTodoListDto = new ReadTodoListDto(todoListInfo.getCode(), todoListInfo.getTodoList(), todoListInfo.getWriter());public static ReadTodoListDto of(TodoListInfo todoListInfo) {
return ReadTodoListDto.builder()
.code(todoListInfo.getCode())
.todoDtoList(todoListInfo.getTodoList()
.stream()
.map(todo -> TodoDto.of(todo))
.toList())
.writer(LoginOutputDto.of(todoListInfo.getWriter()))
.build();
}@NoArgsConstructor
참고
Last updated