package com.pollex.pam.service.mapper; import static java.util.stream.Collectors.toList; import java.util.List; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import com.pollex.pam.domain.InterviewRecord; import com.pollex.pam.service.dto.InterviewRecordDTO; @Service public class InterviewRecordMapper { public InterviewRecord toInterviewRecord(InterviewRecordDTO source) { InterviewRecord target = new InterviewRecord(); BeanUtils.copyProperties(source, target); return target; } public void copyToInterviewRecord(InterviewRecordDTO source, InterviewRecord target) { BeanUtils.copyProperties(source, target); } public List toInterviewRecordDTO(List records) { return records.stream() .map(s-> toInterviewRecordDTO(s)) .collect(toList()); } public InterviewRecordDTO toInterviewRecordDTO(InterviewRecord source) { InterviewRecordDTO target = new InterviewRecordDTO(); BeanUtils.copyProperties(source, target); return target; } }