-
Notifications
You must be signed in to change notification settings - Fork 0
/
UserAccountBuilder.java
44 lines (36 loc) · 1.14 KB
/
UserAccountBuilder.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
package hr.ivlahek.showcase.persistence.entity;
public final class UserAccountBuilder {
private Integer id;
private String firstName = "first-name";
private String lastName = "last-name";
private Organization organization;
private UserAccountBuilder() {
}
public static UserAccountBuilder anUser() {
return new UserAccountBuilder();
}
public UserAccountBuilder withId(Integer id) {
this.id = id;
return this;
}
public UserAccountBuilder withFirstName(String firstName) {
this.firstName = firstName;
return this;
}
public UserAccountBuilder withLastName(String lastName) {
this.lastName = lastName;
return this;
}
public UserAccountBuilder withOrganization(Organization organization) {
this.organization = organization;
return this;
}
public UserAccount build() {
UserAccount userAccount = new UserAccount();
userAccount.setId(id);
userAccount.setFirstName(firstName);
userAccount.setLastName(lastName);
userAccount.setOrganization(organization);
return userAccount;
}
}