-
Notifications
You must be signed in to change notification settings - Fork 248
/
Copy pathCourse.java
67 lines (50 loc) · 1.57 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
61
62
63
64
65
66
67
package nextstep.courses.domain;
import nextstep.courses.common.SystemTimeStamp;
import nextstep.courses.domain.session.Session;
import nextstep.courses.domain.session.Sessions;
import java.time.LocalDateTime;
public class Course {
private Long id;
private String title;
private Sessions sessions;
private Long creatorId;
private SystemTimeStamp systemTimeStamp;
public Course(long id, String title, Long creatorId) {
this(id, title, creatorId, new SystemTimeStamp(LocalDateTime.now(), null));
}
public Course(Long id, String title, Long creatorId, SystemTimeStamp systemTimeStamp) {
this.id = id;
this.title = title;
this.sessions = Sessions.initialize();
this.creatorId = creatorId;
this.systemTimeStamp = systemTimeStamp;
}
public void addSession(Session session) {
sessions.addSession(session);
}
public Long getId() {
return id;
}
public String getTitle() {
return title;
}
public Sessions getSessions() {
return sessions;
}
public Long getCreatorId() {
return creatorId;
}
public LocalDateTime getCreatedAt() {
return systemTimeStamp.getCreatedAt();
}
@Override
public String toString() {
return "Course{" +
"id=" + id +
", title='" + title + '\'' +
", creatorId=" + creatorId +
", createdAt=" + systemTimeStamp.getCreatedAt() +
", updatedAt=" + systemTimeStamp.getUpdatedAt() +
'}';
}
}