Back to project page doubanbook4android.
The source code is released under:
Eclipse Public License - v 1.0 THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECI...
If you think the Android project doubanbook4android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.study.doubanbook_for_android.auth; /* w ww . j a va2 s . co m*/ import android.text.TextUtils; public class AccessToken { private String mAccessToken = ""; private String mRefreshToken = ""; private long mExpiresTime = 0; private String doubanUserId = ""; public AccessToken() { } /** * Oauth2AccessToken??????????accessToken ?expires_in ???AccessToken?? * @param accessToken ???? * @param expiresIn ?????????????????????????expires_in????????????????????? */ public AccessToken(String accessToken, String expiresIn) { mAccessToken = accessToken; mExpiresTime = System.currentTimeMillis() + Long.parseLong(expiresIn)*1000; } /** * AccessToken??????,??accessToken????expiresTime?????false???????true * @return ??accessToken????expiresTime?????false???????true */ public boolean isSessionValid() { return (!TextUtils.isEmpty(mAccessToken) && (mExpiresTime == 0 || (System .currentTimeMillis() < mExpiresTime))); } /** * ????accessToken */ public String getToken() { return this.mAccessToken; } /** * ????refreshToken */ public String getRefreshToken() { return mRefreshToken; } /** * ??refreshToken * @param mRefreshToken */ public void setRefreshToken(String mRefreshToken) { this.mRefreshToken = mRefreshToken; } /** * ??????????????: ?????????????1970?01?01?00?00?00??????? ??? */ public long getExpiresTime() { return mExpiresTime; } /** * ???????????????????????????????? * */ public void setExpiresIn(String expiresIn) { if (expiresIn != null && !expiresIn.equals("0")) { setExpiresTime(System.currentTimeMillis() + Long.parseLong(expiresIn) * 1000); } } /** * ??????? ??? * @param mExpiresTime ???????????????????1970?01?01?00?00?00??????? ??? * */ public void setExpiresTime(long mExpiresTime) { this.mExpiresTime = mExpiresTime; } /** * ??accessToken * @param mToken */ public void setToken(String mToken) { this.mAccessToken = mToken; } public String getDoubanUserId() { return doubanUserId; } public void setDoubanUserId(String doubanUserId) { this.doubanUserId = doubanUserId; } }