-
Notifications
You must be signed in to change notification settings - Fork 307
Expand file tree
/
Copy pathEnrollment.java
More file actions
43 lines (33 loc) · 1007 Bytes
/
Enrollment.java
File metadata and controls
43 lines (33 loc) · 1007 Bytes
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
package nextstep.courses.domain;
public class Enrollment {
private Member student;
private Session session;
private EnrollmentStatus status; // PENDING, APPROVED, REJECTED
public Enrollment(Member student, Session session) {
this.student = student;
this.session = session;
this.status = EnrollmentStatus.PENDING;
}
public void approve() {
if (this.status == EnrollmentStatus.APPROVED) {
throw new IllegalStateException("이미 승인된 수강 신청입니다.");
}
this.status = EnrollmentStatus.APPROVED;
session.accept();
}
public void reject() {
this.status = EnrollmentStatus.REJECTED;
}
public boolean isApproved() {
return status == EnrollmentStatus.APPROVED;
}
public Member getStudent() {
return student;
}
public EnrollmentStatus getStatus() {
return status;
}
public Session getSession() {
return session;
}
}