-
Notifications
You must be signed in to change notification settings - Fork 297
/
Copy pathCourse.java
60 lines (46 loc) · 1.46 KB
/
Course.java
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package nextstep.courses.domain.course;
import nextstep.courses.domain.BaseEntity;
import nextstep.courses.domain.course.session.Session;
import nextstep.courses.domain.course.session.Sessions;
import java.time.LocalDateTime;
public class Course extends BaseEntity {
private final Long id;
private final String title;
private final int ordering;
private final Sessions sessions;
public Course(String title, int ordering, Long creatorId, LocalDateTime date) {
this(0L, title, ordering, new Sessions(), creatorId, date, null);
}
public Course(Long id, String title, int ordering, Sessions sessions,
Long creatorId, LocalDateTime createdAt, LocalDateTime updatedAt) {
super(creatorId, createdAt, updatedAt);
this.id = id;
this.title = title;
this.ordering = ordering;
this.sessions = sessions;
}
public void addSession(Session session) {
this.sessions.add(session);
}
public Long id() {
return id;
}
public String title() {
return title;
}
public int ordering() {
return this.ordering;
}
public Sessions sessions() {
return this.sessions;
}
@Override
public String toString() {
return "Course{" +
"id=" + id +
", title='" + title + '\'' +
", ordering=" + ordering +
", sessions=" + sessions +
'}';
}
}