-
Notifications
You must be signed in to change notification settings - Fork 214
Expand file tree
/
Copy pathStudentResponse.java
More file actions
43 lines (35 loc) · 1 KB
/
StudentResponse.java
File metadata and controls
43 lines (35 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package tv.codely.mooc.students.application;
import tv.codely.mooc.students.domain.Student;
import tv.codely.shared.domain.bus.query.Response;
public final class StudentResponse implements Response {
private final String id;
private final String name;
private final String surname;
private final String email;
public StudentResponse(String id, String name, String surname, String email) {
this.id = id;
this.name = name;
this.surname = surname;
this.email = email;
}
public static StudentResponse fromAggregate(Student student) {
return new StudentResponse(
student.id().value(),
student.name().value(),
student.surname().value(),
student.email().value()
);
}
public String id() {
return id;
}
public String name() {
return name;
}
public String surname() {
return surname;
}
public String email() {
return email;
}
}