Skip to content

Commit 4e67dbe

Browse files
committed
fix warnings
1 parent 1388060 commit 4e67dbe

File tree

1 file changed

+34
-27
lines changed

1 file changed

+34
-27
lines changed

weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpInMemoryConfigStorage.java

Lines changed: 34 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
package me.chanjar.weixin.cp.api;
22

3+
import java.io.File;
4+
5+
import org.apache.commons.lang3.builder.ToStringBuilder;
6+
import org.apache.commons.lang3.builder.ToStringStyle;
7+
38
import me.chanjar.weixin.common.bean.WxAccessToken;
49
import me.chanjar.weixin.common.util.http.ApacheHttpClientBuilder;
510

6-
import java.io.File;
7-
811
/**
912
* 基于内存的微信配置provider,在实际生产环境中应该将这些配置持久化
1013
*
@@ -35,6 +38,7 @@ public class WxCpInMemoryConfigStorage implements WxCpConfigStorage {
3538

3639
private volatile ApacheHttpClientBuilder apacheHttpClientBuilder;
3740

41+
@Override
3842
public String getAccessToken() {
3943
return this.accessToken;
4044
}
@@ -43,54 +47,62 @@ public void setAccessToken(String accessToken) {
4347
this.accessToken = accessToken;
4448
}
4549

50+
@Override
4651
public boolean isAccessTokenExpired() {
4752
return System.currentTimeMillis() > this.expiresTime;
4853
}
4954

55+
@Override
5056
public void expireAccessToken() {
5157
this.expiresTime = 0;
5258
}
5359

60+
@Override
5461
public synchronized void updateAccessToken(WxAccessToken accessToken) {
5562
updateAccessToken(accessToken.getAccessToken(), accessToken.getExpiresIn());
5663
}
5764

65+
@Override
5866
public synchronized void updateAccessToken(String accessToken, int expiresInSeconds) {
5967
this.accessToken = accessToken;
6068
this.expiresTime = System.currentTimeMillis() + (expiresInSeconds - 200) * 1000l;
6169
}
6270

6371
@Override
6472
public String getJsapiTicket() {
65-
return jsapiTicket;
73+
return this.jsapiTicket;
6674
}
6775

6876
public void setJsapiTicket(String jsapiTicket) {
6977
this.jsapiTicket = jsapiTicket;
7078
}
7179

7280
public long getJsapiTicketExpiresTime() {
73-
return jsapiTicketExpiresTime;
81+
return this.jsapiTicketExpiresTime;
7482
}
7583

7684
public void setJsapiTicketExpiresTime(long jsapiTicketExpiresTime) {
7785
this.jsapiTicketExpiresTime = jsapiTicketExpiresTime;
7886
}
7987

88+
@Override
8089
public boolean isJsapiTicketExpired() {
8190
return System.currentTimeMillis() > this.jsapiTicketExpiresTime;
8291
}
8392

93+
@Override
8494
public synchronized void updateJsapiTicket(String jsapiTicket, int expiresInSeconds) {
8595
this.jsapiTicket = jsapiTicket;
8696
// 预留200秒的时间
8797
this.jsapiTicketExpiresTime = System.currentTimeMillis() + (expiresInSeconds - 200) * 1000l;
8898
}
8999

100+
@Override
90101
public void expireJsapiTicket() {
91102
this.jsapiTicketExpiresTime = 0;
92103
}
93104

105+
@Override
94106
public String getCorpId() {
95107
return this.corpId;
96108
}
@@ -99,6 +111,7 @@ public void setCorpId(String corpId) {
99111
this.corpId = corpId;
100112
}
101113

114+
@Override
102115
public String getCorpSecret() {
103116
return this.corpSecret;
104117
}
@@ -107,6 +120,7 @@ public void setCorpSecret(String corpSecret) {
107120
this.corpSecret = corpSecret;
108121
}
109122

123+
@Override
110124
public String getToken() {
111125
return this.token;
112126
}
@@ -115,6 +129,7 @@ public void setToken(String token) {
115129
this.token = token;
116130
}
117131

132+
@Override
118133
public long getExpiresTime() {
119134
return this.expiresTime;
120135
}
@@ -123,16 +138,18 @@ public void setExpiresTime(long expiresTime) {
123138
this.expiresTime = expiresTime;
124139
}
125140

141+
@Override
126142
public String getAesKey() {
127-
return aesKey;
143+
return this.aesKey;
128144
}
129145

130146
public void setAesKey(String aesKey) {
131147
this.aesKey = aesKey;
132148
}
133149

150+
@Override
134151
public String getAgentId() {
135-
return agentId;
152+
return this.agentId;
136153
}
137154

138155
public void setAgentId(String agentId) {
@@ -148,32 +165,36 @@ public void setOauth2redirectUri(String oauth2redirectUri) {
148165
this.oauth2redirectUri = oauth2redirectUri;
149166
}
150167

168+
@Override
151169
public String getHttp_proxy_host() {
152-
return http_proxy_host;
170+
return this.http_proxy_host;
153171
}
154172

155173
public void setHttp_proxy_host(String http_proxy_host) {
156174
this.http_proxy_host = http_proxy_host;
157175
}
158176

177+
@Override
159178
public int getHttp_proxy_port() {
160-
return http_proxy_port;
179+
return this.http_proxy_port;
161180
}
162181

163182
public void setHttp_proxy_port(int http_proxy_port) {
164183
this.http_proxy_port = http_proxy_port;
165184
}
166185

186+
@Override
167187
public String getHttp_proxy_username() {
168-
return http_proxy_username;
188+
return this.http_proxy_username;
169189
}
170190

171191
public void setHttp_proxy_username(String http_proxy_username) {
172192
this.http_proxy_username = http_proxy_username;
173193
}
174194

195+
@Override
175196
public String getHttp_proxy_password() {
176-
return http_proxy_password;
197+
return this.http_proxy_password;
177198
}
178199

179200
public void setHttp_proxy_password(String http_proxy_password) {
@@ -182,26 +203,12 @@ public void setHttp_proxy_password(String http_proxy_password) {
182203

183204
@Override
184205
public String toString() {
185-
return "WxCpInMemoryConfigStorage{" +
186-
"corpId='" + corpId + '\'' +
187-
", corpSecret='" + corpSecret + '\'' +
188-
", token='" + token + '\'' +
189-
", accessToken='" + accessToken + '\'' +
190-
", aesKey='" + aesKey + '\'' +
191-
", agentId='" + agentId + '\'' +
192-
", expiresTime=" + expiresTime +
193-
", http_proxy_host='" + http_proxy_host + '\'' +
194-
", http_proxy_port=" + http_proxy_port +
195-
", http_proxy_username='" + http_proxy_username + '\'' +
196-
", http_proxy_password='" + http_proxy_password + '\'' +
197-
", jsapiTicket='" + jsapiTicket + '\'' +
198-
", jsapiTicketExpiresTime='" + jsapiTicketExpiresTime + '\'' +
199-
", tmpDirFile='" + tmpDirFile + '\'' +
200-
'}';
206+
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
201207
}
202208

209+
@Override
203210
public File getTmpDirFile() {
204-
return tmpDirFile;
211+
return this.tmpDirFile;
205212
}
206213

207214
public void setTmpDirFile(File tmpDirFile) {

0 commit comments

Comments
 (0)