code for Introduction to Project Jigsaw BAEL-603 (#1421)
This commit is contained in:
parent
a794db3183
commit
fbd5d1d2a8
|
@ -0,0 +1 @@
|
|||
javac -d mods --module-source-path src/modules $(find src/modules -name "*.java")
|
|
@ -0,0 +1,3 @@
|
|||
javac --module-path mods -d mods/com.baeldung.student.client^
|
||||
src/modules/com.baeldung.student.client/module-info.java^
|
||||
src/modules/com.baeldung.student.client/com/baeldung/student/client/StudentClient.java
|
|
@ -0,0 +1,2 @@
|
|||
javac -d mods/com.baeldung.student.model src/modules/com.baeldung.student.model/module-info.java^
|
||||
src/modules/com.baeldung.student.model/com/baeldung/student/model/Student.java
|
|
@ -0,0 +1,3 @@
|
|||
javac --module-path mods -d mods/com.baeldung.student.service.dbimpl^
|
||||
src/modules/com.baeldung.student.service.dbimpl/module-info.java^
|
||||
src/modules/com.baeldung.student.service.dbimpl/com/baeldung/student/service/dbimpl/StudentDbService.java
|
|
@ -0,0 +1,3 @@
|
|||
javac --module-path mods -d mods/com.baeldung.student.service^
|
||||
src/modules/com.baeldung.student.service/module-info.java^
|
||||
src/modules/com.baeldung.student.service/com/baeldung/student/service/StudentService.java
|
|
@ -0,0 +1 @@
|
|||
java --module-path mods -m com.baeldung.student.client/com.baeldung.student.client.StudentClient
|
|
@ -0,0 +1 @@
|
|||
java --module-path mods -m com.baeldung.student.client/com.baeldung.student.client.StudentClient
|
|
@ -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,12 @@
|
|||
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;
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
module com.baeldung.student.model{
|
||||
exports com.baeldung.student.model;
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package com.baeldung.student.service.dbimpl;
|
||||
|
||||
import com.baeldung.student.service.StudentService;
|
||||
import com.baeldung.student.model.Student;
|
||||
|
||||
public class StudentDbService implements StudentService{
|
||||
|
||||
public String create(Student student){
|
||||
System.out.println("Creating student in DB...");
|
||||
return student.registrationId;
|
||||
}
|
||||
|
||||
public Student read(String registrationId){
|
||||
System.out.println("Reading student from DB...");
|
||||
return new Student();
|
||||
}
|
||||
|
||||
public Student update(Student student){
|
||||
System.out.println("Updating sutdent in DB...");
|
||||
return student;
|
||||
}
|
||||
|
||||
public String delete(String registrationId){
|
||||
System.out.println("Deleteing sutdent in DB...");
|
||||
return registrationId;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
module com.baeldung.student.service.dbimpl{
|
||||
requires transitive com.baeldung.student.service;
|
||||
exports com.baeldung.student.service.dbimpl;
|
||||
}
|
|
@ -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;
|
||||
}
|
Loading…
Reference in New Issue