#BAEL-16633 split Core Java 9 module - Jigsaw
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
package com.baeldung.student.client;
|
||||
|
||||
import com.baeldung.student.service.StudentService;
|
||||
import com.baeldung.student.service.dbimpl.StudentDbService;
|
||||
import com.baeldung.student.model.Student;
|
||||
|
||||
public class StudentClient {
|
||||
|
||||
public static void main(String[] args) {
|
||||
StudentService service = new StudentDbService();
|
||||
service.create(new Student());
|
||||
service.read("17SS0001");
|
||||
service.update(new Student());
|
||||
service.delete("17SS0001");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
module com.baeldung.student.client{
|
||||
requires com.baeldung.student.service.dbimpl;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.baeldung.student.model;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class Student {
|
||||
private String registrationId;
|
||||
|
||||
public String getRegistrationId() {
|
||||
return registrationId;
|
||||
}
|
||||
|
||||
public void setRegistrationId(String registrationId) {
|
||||
this.registrationId = registrationId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
module com.baeldung.student.model{
|
||||
exports com.baeldung.student.model;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
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 {
|
||||
|
||||
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) {
|
||||
logger.log(Level.INFO, "Reading student from DB...");
|
||||
return new Student();
|
||||
}
|
||||
|
||||
public Student update(Student student) {
|
||||
logger.log(Level.INFO, "Updating sutdent in DB...");
|
||||
return student;
|
||||
}
|
||||
|
||||
public String delete(String registrationId) {
|
||||
logger.log(Level.INFO, "Deleteing sutdent in DB...");
|
||||
return registrationId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
module com.baeldung.student.service.dbimpl{
|
||||
requires transitive com.baeldung.student.service;
|
||||
exports com.baeldung.student.service.dbimpl;
|
||||
requires java.logging;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.baeldung.student.service;
|
||||
|
||||
import com.baeldung.student.model.Student;
|
||||
|
||||
public interface StudentService {
|
||||
|
||||
public String create(Student student);
|
||||
|
||||
public Student read(String registrationId);
|
||||
|
||||
public Student update(Student student);
|
||||
|
||||
public String delete(String registrationId);
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
module com.baeldung.student.service{
|
||||
requires transitive com.baeldung.student.model;
|
||||
exports com.baeldung.student.service;
|
||||
}
|
||||
Reference in New Issue
Block a user