ProfileBuilder.java
900 Bytes
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
package com.srh.api.builder;
import com.srh.api.model.ApiUser;
import com.srh.api.model.Profile;
import java.util.List;
public final class ProfileBuilder {
private Integer id;
private String name;
private List<ApiUser> apiUsers;
private ProfileBuilder() {
}
public static ProfileBuilder aProfile() {
return new ProfileBuilder();
}
public ProfileBuilder withId(Integer id) {
this.id = id;
return this;
}
public ProfileBuilder withName(String name) {
this.name = name;
return this;
}
public ProfileBuilder withApiUsers(List<ApiUser> apiUsers) {
this.apiUsers = apiUsers;
return this;
}
public Profile build() {
Profile profile = new Profile();
profile.setId(id);
profile.setName(name);
profile.setApiUsers(apiUsers);
return profile;
}
}