ApiUserBuilder.java
1.6 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package com.srh.api.builder;
import com.srh.api.model.ApiUser;
import com.srh.api.model.Profile;
import java.util.List;
public final class ApiUserBuilder {
protected String login;
protected String password;
private List<Profile> profiles;
private Integer id;
private String oldPassword;
private String name;
private String email;
private ApiUserBuilder() {
}
public static ApiUserBuilder anApiUser() {
return new ApiUserBuilder();
}
public ApiUserBuilder withProfiles(List<Profile> profiles) {
this.profiles = profiles;
return this;
}
public ApiUserBuilder withId(Integer id) {
this.id = id;
return this;
}
public ApiUserBuilder withLogin(String login) {
this.login = login;
return this;
}
public ApiUserBuilder withOldPassword(String oldPassword) {
this.oldPassword = oldPassword;
return this;
}
public ApiUserBuilder withName(String name) {
this.name = name;
return this;
}
public ApiUserBuilder withEmail(String email) {
this.email = email;
return this;
}
public ApiUserBuilder withPassword(String password) {
this.password = password;
return this;
}
public ApiUser build() {
ApiUser apiUser = new ApiUser();
apiUser.setProfiles(profiles);
apiUser.setId(id);
apiUser.setLogin(login);
apiUser.setOldPassword(oldPassword);
apiUser.setName(name);
apiUser.setEmail(email);
apiUser.setPassword(password);
return apiUser;
}
}