-
Notifications
You must be signed in to change notification settings - Fork 282
Expand file tree
/
Copy pathPrivacy.java
More file actions
74 lines (57 loc) · 1.55 KB
/
Privacy.java
File metadata and controls
74 lines (57 loc) · 1.55 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
71
72
73
74
package com.example.apijsondemo.model;
import java.util.List;
import com.alibaba.fastjson.annotation.JSONField;
import apijson.framework.BaseModel;
import apijson.orm.Visitor;
/**
* 用户隐私信息
*
* @author Lemon
*/
public class Privacy extends BaseModel implements Visitor<Long> {
private static final long serialVersionUID = 1L;
private String username; // 用户名
private String password; // 登录密码,隐藏字段
private List<Long> contactIdList; // 朋友列表
public Privacy() {
super();
}
public Privacy(long id) {
this();
setId(id);
}
public Privacy(String username, String password) {
this();
setUserName(username);
setPassword(password);
}
// 默认会将属性设置为userName,想去掉大写的N,就要加注释
@JSONField(name = "username")
public String getUserName() {
return username;
}
public Privacy setUserName(String username) {
this.username = username;
return this;
}
/**
* fastjson >= 1.2.70 的版本时,JSON.toJSONString 后,
* get__password, get_password 会分别转为 __password, password,
* 不像之前(例如 1.2.61 及以下)分别转为 _password, password,
* 如果 @JSONField(name="_password") 未生效,请勿使用 1.2.70-1.2.73,或调整数据库字段命名为 __password
*
* @return
*/
@JSONField(name = "_password")
public String get__password() {
return password;
}
public Privacy setPassword(String password) {
this.password = password;
return this;
}
@Override
public List<Long> getContactIdList() {
return contactIdList;
}
}