View Javadoc
1   package com.foxinmy.weixin4j.mp.model;
2   
3   import com.alibaba.fastjson.annotation.JSONField;
4   import com.foxinmy.weixin4j.model.Token;
5   
6   /**
7    * 用户授权token 一般通过授权页面获得
8    *
9    * @className OauthToken
10   * @author jinyu(foxinmy@gmail.com)
11   * @date 2014年4月6日
12   * @since JDK 1.6
13   */
14  public class OauthToken extends Token {
15  
16  	private static final long serialVersionUID = 1L;
17  
18  	/**
19  	 * 用户的openid
20  	 */
21  	@JSONField(name = "openid")
22  	private String openId;
23  	/**
24  	 * 只有在用户将公众号绑定到微信开放平台帐号后,才会出现该字段
25  	 */
26  	@JSONField(name = "unionid")
27  	private String unionId;
28  
29  	/**
30  	 * 刷新token时的凭证
31  	 */
32  	@JSONField(name = "refresh_token")
33  	private String refreshToken;
34  
35  	private String scope;
36  
37  	public OauthToken(String accessToken, long expires) {
38  		super(accessToken, expires);
39  	}
40  
41  	public String getOpenId() {
42  		return openId;
43  	}
44  
45  	public void setOpenId(String openId) {
46  		this.openId = openId;
47  	}
48  
49  	public String getUnionId() {
50  		return unionId;
51  	}
52  
53  	public void setUnionId(String unionId) {
54  		this.unionId = unionId;
55  	}
56  
57  	public String getRefreshToken() {
58  		return refreshToken;
59  	}
60  
61  	public void setRefreshToken(String refreshToken) {
62  		this.refreshToken = refreshToken;
63  	}
64  
65  	public String getScope() {
66  		return scope;
67  	}
68  
69  	public void setScope(String scope) {
70  		this.scope = scope;
71  	}
72  
73  	@Override
74  	public String toString() {
75  		return "OauthToken [openId=" + openId + ", unionId=" + unionId
76  				+ ", refreshToken=" + refreshToken + ", scope=" + scope + ", "
77  				+ super.toString() + "]";
78  	}
79  }