Package com.foxinmy.weixin4j.model
Class Token
- java.lang.Object
-
- com.foxinmy.weixin4j.model.Token
-
- All Implemented Interfaces:
Cacheable,Serializable
- Direct Known Subclasses:
ComponentAuthorizerToken,OauthToken
public class Token extends Object implements Cacheable
access_token是公众号的全局唯一票据,公众号调用各接口时都需使用access_token,正常情况下access_token有效期为7200秒, 重复获取将导致上次获取的access_token失效- Since:
- JDK 1.6
- Author:
- jinyu(foxinmy@gmail.com)
- See Also:
- 微信公众平台获取token, 微信企业号的主动模式, Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetAccessToken()longgetCreateTime()创建时间(单位:毫秒)longgetExpires()过期时间(单位:毫秒),值小于0时视为永不过期Map<String,String>getExtra()TokenpushExtra(String name, String value)StringtoString()
-
-
-
Constructor Detail
-
Token
public Token(String accessToken)
永不过期、创建时间为当前时间戳的token对象- Parameters:
accessToken- 凭证字符串
-
Token
public Token(String accessToken, long expires)
有过期时间、创建时间为当前时间戳的token对象- Parameters:
accessToken- 凭证字符串expires- 过期时间 单位毫秒
-
Token
public Token(String accessToken, long expires, long createTime)
- Parameters:
accessToken- 凭证字符串expires- 过期时间 单位毫秒createTime- 创建时间戳 单位毫秒
-
-
Method Detail
-
getAccessToken
public String getAccessToken()
-
getExpires
public long getExpires()
Description copied from interface:Cacheable过期时间(单位:毫秒),值小于0时视为永不过期- Specified by:
getExpiresin interfaceCacheable- Returns:
- 缓存过期时间
-
getCreateTime
public long getCreateTime()
Description copied from interface:Cacheable创建时间(单位:毫秒)- Specified by:
getCreateTimein interfaceCacheable- Returns:
- 缓存对象创建时间
-
-