mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2026-03-10 00:13:40 +08:00
🎨 批量格式化部分代码
This commit is contained in:
@@ -14,30 +14,30 @@ import java.lang.reflect.Type;
|
||||
*/
|
||||
public class WxFastMaAccountBasicInfoGsonAdapter implements JsonDeserializer<WxFastMaAccountBasicInfoResult> {
|
||||
@Override
|
||||
public WxFastMaAccountBasicInfoResult deserialize (JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) throws JsonParseException {
|
||||
WxFastMaAccountBasicInfoResult accountBasicInfo = new WxFastMaAccountBasicInfoResult ();
|
||||
public WxFastMaAccountBasicInfoResult deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) throws JsonParseException {
|
||||
WxFastMaAccountBasicInfoResult accountBasicInfo = new WxFastMaAccountBasicInfoResult();
|
||||
JsonObject jsonObject = jsonElement.getAsJsonObject();
|
||||
|
||||
accountBasicInfo.setAppId (GsonHelper.getString(jsonObject, "appid"));
|
||||
accountBasicInfo.setAccountType (GsonHelper.getInteger (jsonObject, "account_type"));
|
||||
accountBasicInfo.setPrincipalType (GsonHelper.getInteger (jsonObject, "principal_type"));
|
||||
accountBasicInfo.setPrincipalName (GsonHelper.getString(jsonObject, "principal_name"));
|
||||
accountBasicInfo.setRealnameStatus (GsonHelper.getInteger (jsonObject, "realname_status"));
|
||||
accountBasicInfo.setAppId(GsonHelper.getString(jsonObject, "appid"));
|
||||
accountBasicInfo.setAccountType(GsonHelper.getInteger(jsonObject, "account_type"));
|
||||
accountBasicInfo.setPrincipalType(GsonHelper.getInteger(jsonObject, "principal_type"));
|
||||
accountBasicInfo.setPrincipalName(GsonHelper.getString(jsonObject, "principal_name"));
|
||||
accountBasicInfo.setRealnameStatus(GsonHelper.getInteger(jsonObject, "realname_status"));
|
||||
|
||||
WxFastMaAccountBasicInfoResult.WxVerifyInfo verifyInfo = WxOpenGsonBuilder.create().fromJson(jsonObject.get("wx_verify_info"),
|
||||
new TypeToken<WxFastMaAccountBasicInfoResult.WxVerifyInfo> () {
|
||||
new TypeToken<WxFastMaAccountBasicInfoResult.WxVerifyInfo>() {
|
||||
}.getType());
|
||||
accountBasicInfo.setWxVerifyInfo (verifyInfo);
|
||||
accountBasicInfo.setWxVerifyInfo(verifyInfo);
|
||||
|
||||
WxFastMaAccountBasicInfoResult.SignatureInfo signatureInfo = WxOpenGsonBuilder.create().fromJson(jsonObject.get("signature_info"),
|
||||
new TypeToken<WxFastMaAccountBasicInfoResult.SignatureInfo> () {
|
||||
new TypeToken<WxFastMaAccountBasicInfoResult.SignatureInfo>() {
|
||||
}.getType());
|
||||
accountBasicInfo.setSignatureInfo (signatureInfo);
|
||||
accountBasicInfo.setSignatureInfo(signatureInfo);
|
||||
|
||||
WxFastMaAccountBasicInfoResult.HeadImageInfo headImageInfo = WxOpenGsonBuilder.create().fromJson(jsonObject.get("head_image_info"),
|
||||
new TypeToken<WxFastMaAccountBasicInfoResult.HeadImageInfo> () {
|
||||
new TypeToken<WxFastMaAccountBasicInfoResult.HeadImageInfo>() {
|
||||
}.getType());
|
||||
accountBasicInfo.setHeadImageInfo (headImageInfo);
|
||||
accountBasicInfo.setHeadImageInfo(headImageInfo);
|
||||
|
||||
return accountBasicInfo;
|
||||
}
|
||||
|
||||
@@ -11,28 +11,29 @@ import java.util.*;
|
||||
* @author robgao
|
||||
* @Email 315789501@qq.com
|
||||
*/
|
||||
public class WxOpenAuthorizerListResultGsonAdapter implements JsonDeserializer<WxOpenAuthorizerListResult> {
|
||||
public class WxOpenAuthorizerListResultGsonAdapter implements JsonDeserializer<WxOpenAuthorizerListResult> {
|
||||
|
||||
private static final String AUTHORIZER_APPID = "authorizer_appid";
|
||||
private static final String REFRESH_TOKEN = "refresh_token";
|
||||
private static final String AUTH_TIME = "auth_time";
|
||||
|
||||
private static final String AUTHORIZER_APPID="authorizer_appid";
|
||||
private static final String REFRESH_TOKEN="refresh_token";
|
||||
private static final String AUTH_TIME="auth_time";
|
||||
@Override
|
||||
public WxOpenAuthorizerListResult deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) throws JsonParseException {
|
||||
JsonObject jsonObject = jsonElement.getAsJsonObject();
|
||||
|
||||
WxOpenAuthorizerListResult wxOpenAuthorizerListResult= new WxOpenAuthorizerListResult();
|
||||
WxOpenAuthorizerListResult wxOpenAuthorizerListResult = new WxOpenAuthorizerListResult();
|
||||
wxOpenAuthorizerListResult.setTotalCount(GsonHelper.getInteger(jsonObject, "total_count").intValue());
|
||||
|
||||
List<Map<String,String>> list = new ArrayList<>();
|
||||
List<Map<String, String>> list = new ArrayList<>();
|
||||
Iterator<JsonElement> jsonElementIterator = jsonObject.getAsJsonArray("list").iterator();
|
||||
|
||||
while(jsonElementIterator.hasNext()){
|
||||
while (jsonElementIterator.hasNext()) {
|
||||
JsonObject authorizer = jsonElementIterator.next().getAsJsonObject();
|
||||
Map<String,String> authorizerMap = new HashMap<>(10);
|
||||
Map<String, String> authorizerMap = new HashMap<>(10);
|
||||
|
||||
authorizerMap.put(AUTHORIZER_APPID, GsonHelper.getString(authorizer,AUTHORIZER_APPID));
|
||||
authorizerMap.put(REFRESH_TOKEN, GsonHelper.getString(authorizer,REFRESH_TOKEN));
|
||||
authorizerMap.put(AUTH_TIME, GsonHelper.getString(authorizer,AUTH_TIME));
|
||||
authorizerMap.put(AUTHORIZER_APPID, GsonHelper.getString(authorizer, AUTHORIZER_APPID));
|
||||
authorizerMap.put(REFRESH_TOKEN, GsonHelper.getString(authorizer, REFRESH_TOKEN));
|
||||
authorizerMap.put(AUTH_TIME, GsonHelper.getString(authorizer, AUTH_TIME));
|
||||
list.add(authorizerMap);
|
||||
}
|
||||
wxOpenAuthorizerListResult.setList(list);
|
||||
|
||||
@@ -24,8 +24,8 @@ public class WxOpenGsonBuilder {
|
||||
INSTANCE.registerTypeAdapter(WxOpenQueryAuthResult.class, new WxOpenQueryAuthResultGsonAdapter());
|
||||
INSTANCE.registerTypeAdapter(WxOpenAuthorizerInfoResult.class, new WxOpenAuthorizerInfoResultGsonAdapter());
|
||||
INSTANCE.registerTypeAdapter(WxOpenAuthorizerOptionResult.class, new WxOpenAuthorizerOptionResultGsonAdapter());
|
||||
INSTANCE.registerTypeAdapter(WxFastMaAccountBasicInfoResult.class, new WxFastMaAccountBasicInfoGsonAdapter ());
|
||||
INSTANCE.registerTypeAdapter(WxOpenAuthorizerListResult.class, new WxOpenAuthorizerListResultGsonAdapter ());
|
||||
INSTANCE.registerTypeAdapter(WxFastMaAccountBasicInfoResult.class, new WxFastMaAccountBasicInfoGsonAdapter());
|
||||
INSTANCE.registerTypeAdapter(WxOpenAuthorizerListResult.class, new WxOpenAuthorizerListResultGsonAdapter());
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user