-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathUserProfile.java
More file actions
41 lines (33 loc) · 1003 Bytes
/
UserProfile.java
File metadata and controls
41 lines (33 loc) · 1003 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
package api.user;
import api.user.recent.UserRecents;
/**
* All information about a user's profile, contains their user info and recent torrents
*/
public class UserProfile {
private User user;
private UserRecents userRecents;
public static UserProfile fromId(int id){
UserProfile p = new UserProfile();
p.user = User.fromId(id);
p.userRecents = UserRecents.recentsForUser(id);
return p;
}
public User getUser(){
return user;
}
public UserRecents getUserRecents(){
return userRecents;
}
public boolean getStatus(){
return user != null && user.getStatus() && userRecents != null && userRecents.getStatus();
}
public String getError(){
return user != null && user.getError() != null ? user.getError()
: userRecents != null && userRecents.getError() != null ? userRecents.getError() : null;
}
@Override
public String toString(){
return "UserProfile [status=" + (getStatus() ? "true" : "false") + ", user=" + user
+ ", userRecents=" + userRecents + "]";
}
}