mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-10-20 18:47:38 +08:00
优化代码,替换掉ToStringBuilder.reflectionToString相关代码
This commit is contained in:
@@ -2,10 +2,8 @@ package me.chanjar.weixin.common.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import lombok.Data;
|
||||
import me.chanjar.weixin.common.util.json.WxGsonBuilder;
|
||||
|
||||
/**
|
||||
* 卡券Api签名.
|
||||
@@ -37,6 +35,6 @@ public class WxCardApiSignature implements Serializable {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
|
||||
return WxGsonBuilder.create().toJson(this);
|
||||
}
|
||||
}
|
||||
|
@@ -7,9 +7,6 @@ import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import lombok.Data;
|
||||
import me.chanjar.weixin.common.util.json.WxGsonBuilder;
|
||||
|
||||
@@ -49,7 +46,7 @@ public class WxMenu implements Serializable {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
|
||||
return this.toJson();
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -4,11 +4,9 @@ import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
import me.chanjar.weixin.common.util.json.WxGsonBuilder;
|
||||
|
||||
/**
|
||||
* menu button.
|
||||
@@ -83,7 +81,7 @@ public class WxMenuButton implements Serializable {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
|
||||
return WxGsonBuilder.create().toJson(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -2,11 +2,9 @@ package me.chanjar.weixin.common.bean.menu;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
import me.chanjar.weixin.common.util.json.WxGsonBuilder;
|
||||
|
||||
/**
|
||||
* menu rule.
|
||||
@@ -31,6 +29,6 @@ public class WxMenuRule implements Serializable {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
|
||||
return WxGsonBuilder.create().toJson(this);
|
||||
}
|
||||
}
|
||||
|
@@ -2,9 +2,6 @@ package me.chanjar.weixin.common.bean.result;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import lombok.Data;
|
||||
import me.chanjar.weixin.common.util.json.WxGsonBuilder;
|
||||
|
||||
@@ -28,7 +25,7 @@ public class WxMediaUploadResult implements Serializable {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
|
||||
return WxGsonBuilder.create().toJson(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -7,9 +7,13 @@ import me.chanjar.weixin.common.bean.menu.WxMenu;
|
||||
import me.chanjar.weixin.common.error.WxError;
|
||||
import me.chanjar.weixin.common.bean.result.WxMediaUploadResult;
|
||||
|
||||
/**
|
||||
* .
|
||||
* @author chanjarster
|
||||
*/
|
||||
public class WxGsonBuilder {
|
||||
|
||||
public static final GsonBuilder INSTANCE = new GsonBuilder();
|
||||
private static final GsonBuilder INSTANCE = new GsonBuilder();
|
||||
|
||||
static {
|
||||
INSTANCE.disableHtmlEscaping();
|
||||
|
Reference in New Issue
Block a user