Skip to content

Instantly share code, notes, and snippets.

@vavasthi
Created July 5, 2020 14:49
Show Gist options
  • Save vavasthi/6e4f92e8d336cdbf01d7ad9269fde1c7 to your computer and use it in GitHub Desktop.
Save vavasthi/6e4f92e8d336cdbf01d7ad9269fde1c7 to your computer and use it in GitHub Desktop.
package com.avasthi.varahamihir.student.mappers;
import com.avasthi.varahamihir.common.pojos.StudentPojo;
import com.avasthi.varahamihir.student.entities.Student;
import org.springframework.stereotype.Component;
@Component
public class StudentPojoMapper {
public StudentPojo convert(Student s) {
return StudentPojo.builder()
.userId(s.getUserId())
.tenantId(s.getTenantId())
.createdAt(s.getCreatedAt())
.createdBy(s.getCreatedBy())
.updatedBy(s.getUpdatedBy())
.guardianId(s.getGuardianId())
.build(); // Not copying password into pojo
}
public Student convert(StudentPojo s) {
return Student.builder()
.userId(s.getUserId())
.createdAt(s.getCreatedAt())
.createdBy(s.getCreatedBy())
.tenantId(s.getTenantId())
.guardianId(s.getGuardianId())
.updatedAt(s.getUpdatedAt())
.updatedBy(s.getUpdatedBy())
.build();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment