-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathUser.java
More file actions
67 lines (55 loc) · 1.52 KB
/
User.java
File metadata and controls
67 lines (55 loc) · 1.52 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
package model;
import webserver.exception.BusinessException;
public class User {
private Long id;
private String password;
private String name;
private String email;
private String imageUrl;
public User(Long id, String password, String name, String email, String imageUrl) {
this.id = id;
this.password = password;
this.name = name;
this.email = email;
this.imageUrl = imageUrl;
}
public User(String password, String name, String email) {
if (password.isBlank() || name.isBlank() || email.isBlank()) {
throw new BusinessException();
}
if (password == null || name == null || email == null) {
throw new BusinessException();
}
this.password = password;
this.name = name;
this.email = email;
}
public Long getId() {
return id;
}
public String getPassword() {
return password;
}
public String getName() {
return name;
}
public String getEmail() {
return email;
}
public void setId(Long id) {
this.id = id;
}
@Override
public String toString() {
return "User [userId=" + id + ", password=" + password + ", name=" + name + ", email=" + email + "]";
}
public void changeProfileImage(String imageUrl) {
if(imageUrl == null){
throw new BusinessException();
}
this.imageUrl = imageUrl;
}
public String getImageUrl() {
return imageUrl;
}
}