forked from janbodnar/Java-Advanced
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskBuilder.java
More file actions
47 lines (36 loc) · 1.05 KB
/
TaskBuilder.java
File metadata and controls
47 lines (36 loc) · 1.05 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
44
45
46
47
package com.zetcode;
import java.time.LocalDate;
public class TaskBuilder {
private String name;
private String description;
private boolean isFinished = false;
private LocalDate dueDate;
public TaskBuilder() {
}
public TaskBuilder(String name, String description, boolean isFinished,
LocalDate dueDate) {
this.name = name;
this.description = description;
this.isFinished = isFinished;
this.dueDate = dueDate;
}
public TaskBuilder setName(String name) {
this.name = name;
return this;
}
public TaskBuilder setDescription(String description) {
this.description = description;
return this;
}
public TaskBuilder setFinished(boolean isFinished) {
this.isFinished = isFinished;
return this;
}
public TaskBuilder setDueDate(LocalDate dueDate) {
this.dueDate = dueDate;
return this;
}
public Task build() {
return new Task(name, description, isFinished, dueDate);
}
}