blob: 5189f19cf8eee615618a5afc83c0aeed32629dd3 (
plain)
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
|
package com.stileeducation.markr.util;
import com.stileeducation.markr.entity.Student;
import com.stileeducation.markr.entity.TestResult;
import java.util.HashSet;
import java.util.Set;
public class StudentBuilder {
private Long id;
private String firstName;
private String lastName;
private String studentNumber;
private Set<TestResult> testResults = new HashSet<>();
public StudentBuilder withId(Long id) {
this.id = id;
return this;
}
public StudentBuilder withFirstName(String firstName) {
this.firstName = firstName;
return this;
}
public StudentBuilder withLastName(String lastName) {
this.lastName = lastName;
return this;
}
public StudentBuilder withStudentNumber(String studentNumber) {
this.studentNumber = studentNumber;
return this;
}
public StudentBuilder withTestResults(Set<TestResult> testResults) {
this.testResults = testResults;
return this;
}
public Student build() {
Student student = new Student();
student.setId(id);
student.setFirstName(firstName);
student.setLastName(lastName);
student.setStudentNumber(studentNumber);
student.setTestResults(testResults);
return student;
}
}
|