incorporate few review comments for bael-603 (#1429)
This commit is contained in:
parent
99bebe806c
commit
dc90aace68
|
@ -4,7 +4,7 @@ import com.baeldung.student.service.StudentService;
|
|||
import com.baeldung.student.service.dbimpl.StudentDbService;
|
||||
import com.baeldung.student.model.Student;
|
||||
|
||||
public class StudentClient{
|
||||
public class StudentClient {
|
||||
|
||||
public static void main(String[] args) {
|
||||
StudentService service = new StudentDbService();
|
||||
|
|
|
@ -2,11 +2,14 @@ package com.baeldung.student.model;
|
|||
|
||||
import java.util.Date;
|
||||
|
||||
public class Student{
|
||||
public String registrationId;
|
||||
public String firstName;
|
||||
public String lastName;
|
||||
public Date dateOfBirth;
|
||||
public String city;
|
||||
public String country;
|
||||
public class Student {
|
||||
private String registrationId;
|
||||
|
||||
public String getRegistrationId() {
|
||||
return registrationId;
|
||||
}
|
||||
|
||||
public void setRegistrationId(String registrationId) {
|
||||
this.registrationId = registrationId;
|
||||
}
|
||||
}
|
|
@ -2,26 +2,29 @@ package com.baeldung.student.service.dbimpl;
|
|||
|
||||
import com.baeldung.student.service.StudentService;
|
||||
import com.baeldung.student.model.Student;
|
||||
import java.util.logging.*;
|
||||
|
||||
public class StudentDbService implements StudentService{
|
||||
public class StudentDbService implements StudentService {
|
||||
|
||||
public String create(Student student){
|
||||
System.out.println("Creating student in DB...");
|
||||
return student.registrationId;
|
||||
private static Logger logger = Logger.getLogger("StudentDbService");
|
||||
|
||||
public String create(Student student) {
|
||||
logger.log(Level.INFO, "Creating student in DB...");
|
||||
return student.getRegistrationId();
|
||||
}
|
||||
|
||||
public Student read(String registrationId){
|
||||
System.out.println("Reading student from DB...");
|
||||
public Student read(String registrationId) {
|
||||
logger.log(Level.INFO, "Reading student from DB...");
|
||||
return new Student();
|
||||
}
|
||||
|
||||
public Student update(Student student){
|
||||
System.out.println("Updating sutdent in DB...");
|
||||
public Student update(Student student) {
|
||||
logger.log(Level.INFO, "Updating sutdent in DB...");
|
||||
return student;
|
||||
}
|
||||
|
||||
public String delete(String registrationId){
|
||||
System.out.println("Deleteing sutdent in DB...");
|
||||
public String delete(String registrationId) {
|
||||
logger.log(Level.INFO, "Deleteing sutdent in DB...");
|
||||
return registrationId;
|
||||
}
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
module com.baeldung.student.service.dbimpl{
|
||||
requires transitive com.baeldung.student.service;
|
||||
exports com.baeldung.student.service.dbimpl;
|
||||
requires java.logging;
|
||||
}
|
|
@ -2,7 +2,7 @@ package com.baeldung.student.service;
|
|||
|
||||
import com.baeldung.student.model.Student;
|
||||
|
||||
public interface StudentService{
|
||||
public interface StudentService {
|
||||
|
||||
public String create(Student student);
|
||||
|
||||
|
|
Loading…
Reference in New Issue