mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2026-03-10 00:13:40 +08:00
使用lombok的@Data注解简化common模块的所有bean类
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
package me.chanjar.weixin.common.bean;
|
||||
|
||||
import lombok.Data;
|
||||
import me.chanjar.weixin.common.util.json.WxGsonBuilder;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class WxAccessToken implements Serializable {
|
||||
private static final long serialVersionUID = 8709719312922168909L;
|
||||
|
||||
@@ -15,20 +17,4 @@ public class WxAccessToken implements Serializable {
|
||||
return WxGsonBuilder.create().fromJson(json, WxAccessToken.class);
|
||||
}
|
||||
|
||||
public String getAccessToken() {
|
||||
return this.accessToken;
|
||||
}
|
||||
|
||||
public void setAccessToken(String accessToken) {
|
||||
this.accessToken = accessToken;
|
||||
}
|
||||
|
||||
public int getExpiresIn() {
|
||||
return this.expiresIn;
|
||||
}
|
||||
|
||||
public void setExpiresIn(int expiresIn) {
|
||||
this.expiresIn = expiresIn;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
package me.chanjar.weixin.common.bean;
|
||||
|
||||
import lombok.Data;
|
||||
import me.chanjar.weixin.common.util.ToStringUtils;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 卡券Api签名
|
||||
* 卡券Api签名.
|
||||
*
|
||||
* @author YuJian
|
||||
* @version 15/11/8
|
||||
*/
|
||||
@Data
|
||||
public class WxCardApiSignature implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 158176707226975979L;
|
||||
|
||||
private String appId;
|
||||
@@ -37,75 +38,4 @@ public class WxCardApiSignature implements Serializable {
|
||||
return ToStringUtils.toSimpleString(this);
|
||||
}
|
||||
|
||||
public String getAppId() {
|
||||
return this.appId;
|
||||
}
|
||||
|
||||
public void setAppId(String appId) {
|
||||
this.appId = appId;
|
||||
}
|
||||
|
||||
public String getCardId() {
|
||||
return this.cardId;
|
||||
}
|
||||
|
||||
public void setCardId(String cardId) {
|
||||
this.cardId = cardId;
|
||||
}
|
||||
|
||||
public String getCardType() {
|
||||
return this.cardType;
|
||||
}
|
||||
|
||||
public void setCardType(String cardType) {
|
||||
this.cardType = cardType;
|
||||
}
|
||||
|
||||
public String getLocationId() {
|
||||
return this.locationId;
|
||||
}
|
||||
|
||||
public void setLocationId(String locationId) {
|
||||
this.locationId = locationId;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return this.code;
|
||||
}
|
||||
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getOpenId() {
|
||||
return this.openId;
|
||||
}
|
||||
|
||||
public void setOpenId(String openId) {
|
||||
this.openId = openId;
|
||||
}
|
||||
|
||||
public Long getTimestamp() {
|
||||
return this.timestamp;
|
||||
}
|
||||
|
||||
public void setTimestamp(Long timestamp) {
|
||||
this.timestamp = timestamp;
|
||||
}
|
||||
|
||||
public String getNonceStr() {
|
||||
return this.nonceStr;
|
||||
}
|
||||
|
||||
public void setNonceStr(String nonceStr) {
|
||||
this.nonceStr = nonceStr;
|
||||
}
|
||||
|
||||
public String getSignature() {
|
||||
return this.signature;
|
||||
}
|
||||
|
||||
public void setSignature(String signature) {
|
||||
this.signature = signature;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
package me.chanjar.weixin.common.bean;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* jspai signature
|
||||
* jspai signature.
|
||||
*/
|
||||
@Data
|
||||
public class WxJsapiSignature implements Serializable {
|
||||
private static final long serialVersionUID = -1116808193154384804L;
|
||||
|
||||
@@ -18,43 +21,4 @@ public class WxJsapiSignature implements Serializable {
|
||||
|
||||
private String signature;
|
||||
|
||||
public String getSignature() {
|
||||
return this.signature;
|
||||
}
|
||||
|
||||
public void setSignature(String signature) {
|
||||
this.signature = signature;
|
||||
}
|
||||
|
||||
public String getNonceStr() {
|
||||
return nonceStr;
|
||||
}
|
||||
|
||||
public void setNonceStr(String nonceStr) {
|
||||
this.nonceStr = nonceStr;
|
||||
}
|
||||
|
||||
public long getTimestamp() {
|
||||
return this.timestamp;
|
||||
}
|
||||
|
||||
public void setTimestamp(long timestamp) {
|
||||
this.timestamp = timestamp;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return this.url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public String getAppId() {
|
||||
return appId;
|
||||
}
|
||||
|
||||
public void setAppId(String appId) {
|
||||
this.appId = appId;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package me.chanjar.weixin.common.bean.menu;
|
||||
|
||||
import lombok.Data;
|
||||
import me.chanjar.weixin.common.util.ToStringUtils;
|
||||
import me.chanjar.weixin.common.util.json.WxGsonBuilder;
|
||||
|
||||
@@ -15,8 +16,8 @@ import java.util.List;
|
||||
*
|
||||
* @author Daniel Qian
|
||||
*/
|
||||
@Data
|
||||
public class WxMenu implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -7083914585539687746L;
|
||||
|
||||
private List<WxMenuButton> buttons = new ArrayList<>();
|
||||
@@ -40,22 +41,6 @@ public class WxMenu implements Serializable {
|
||||
.fromJson(new InputStreamReader(is, StandardCharsets.UTF_8), WxMenu.class);
|
||||
}
|
||||
|
||||
public List<WxMenuButton> getButtons() {
|
||||
return this.buttons;
|
||||
}
|
||||
|
||||
public void setButtons(List<WxMenuButton> buttons) {
|
||||
this.buttons = buttons;
|
||||
}
|
||||
|
||||
public WxMenuRule getMatchRule() {
|
||||
return this.matchRule;
|
||||
}
|
||||
|
||||
public void setMatchRule(WxMenuRule matchRule) {
|
||||
this.matchRule = matchRule;
|
||||
}
|
||||
|
||||
public String toJson() {
|
||||
return WxGsonBuilder.create().toJson(this);
|
||||
}
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
package me.chanjar.weixin.common.bean.menu;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
import me.chanjar.weixin.common.util.ToStringUtils;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class WxMenuButton implements Serializable {
|
||||
private static final long serialVersionUID = -1070939403109776555L;
|
||||
|
||||
@@ -77,67 +79,4 @@ public class WxMenuButton implements Serializable {
|
||||
return ToStringUtils.toSimpleString(this);
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return this.type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return this.key;
|
||||
}
|
||||
|
||||
public void setKey(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return this.url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public List<WxMenuButton> getSubButtons() {
|
||||
return this.subButtons;
|
||||
}
|
||||
|
||||
public void setSubButtons(List<WxMenuButton> subButtons) {
|
||||
this.subButtons = subButtons;
|
||||
}
|
||||
|
||||
public String getMediaId() {
|
||||
return this.mediaId;
|
||||
}
|
||||
|
||||
public void setMediaId(String mediaId) {
|
||||
this.mediaId = mediaId;
|
||||
}
|
||||
|
||||
public String getAppId() {
|
||||
return appId;
|
||||
}
|
||||
|
||||
public void setAppId(String appId) {
|
||||
this.appId = appId;
|
||||
}
|
||||
|
||||
public String getPagePath() {
|
||||
return pagePath;
|
||||
}
|
||||
|
||||
public void setPagePath(String pagePath) {
|
||||
this.pagePath = pagePath;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package me.chanjar.weixin.common.bean.menu;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
import me.chanjar.weixin.common.util.ToStringUtils;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class WxMenuRule implements Serializable {
|
||||
private static final long serialVersionUID = -4587181819499286670L;
|
||||
|
||||
@@ -20,62 +22,6 @@ public class WxMenuRule implements Serializable {
|
||||
private String clientPlatformType;
|
||||
private String language;
|
||||
|
||||
public String getTagId() {
|
||||
return this.tagId;
|
||||
}
|
||||
|
||||
public void setTagId(String tagId) {
|
||||
this.tagId = tagId;
|
||||
}
|
||||
|
||||
public String getSex() {
|
||||
return this.sex;
|
||||
}
|
||||
|
||||
public void setSex(String sex) {
|
||||
this.sex = sex;
|
||||
}
|
||||
|
||||
public String getCountry() {
|
||||
return this.country;
|
||||
}
|
||||
|
||||
public void setCountry(String country) {
|
||||
this.country = country;
|
||||
}
|
||||
|
||||
public String getProvince() {
|
||||
return this.province;
|
||||
}
|
||||
|
||||
public void setProvince(String province) {
|
||||
this.province = province;
|
||||
}
|
||||
|
||||
public String getCity() {
|
||||
return this.city;
|
||||
}
|
||||
|
||||
public void setCity(String city) {
|
||||
this.city = city;
|
||||
}
|
||||
|
||||
public String getClientPlatformType() {
|
||||
return this.clientPlatformType;
|
||||
}
|
||||
|
||||
public void setClientPlatformType(String clientPlatformType) {
|
||||
this.clientPlatformType = clientPlatformType;
|
||||
}
|
||||
|
||||
public String getLanguage() {
|
||||
return this.language;
|
||||
}
|
||||
|
||||
public void setLanguage(String language) {
|
||||
this.language = language;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return ToStringUtils.toSimpleString(this);
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package me.chanjar.weixin.common.bean.result;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import me.chanjar.weixin.common.util.json.WxGsonBuilder;
|
||||
|
||||
import java.io.Serializable;
|
||||
@@ -9,6 +11,8 @@ import java.io.Serializable;
|
||||
*
|
||||
* @author Daniel Qian
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
public class WxError implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 7869786563361406291L;
|
||||
@@ -23,34 +27,6 @@ public class WxError implements Serializable {
|
||||
return WxGsonBuilder.create().fromJson(json, WxError.class);
|
||||
}
|
||||
|
||||
public static Builder newBuilder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public int getErrorCode() {
|
||||
return this.errorCode;
|
||||
}
|
||||
|
||||
public void setErrorCode(int errorCode) {
|
||||
this.errorCode = errorCode;
|
||||
}
|
||||
|
||||
public String getErrorMsg() {
|
||||
return this.errorMsg;
|
||||
}
|
||||
|
||||
public void setErrorMsg(String errorMsg) {
|
||||
this.errorMsg = errorMsg;
|
||||
}
|
||||
|
||||
public String getJson() {
|
||||
return this.json;
|
||||
}
|
||||
|
||||
public void setJson(String json) {
|
||||
this.json = json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
if (this.json != null) {
|
||||
@@ -59,29 +35,4 @@ public class WxError implements Serializable {
|
||||
return "错误: Code=" + this.errorCode + ", Msg=" + this.errorMsg;
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
private int errorCode;
|
||||
private String errorMsg;
|
||||
|
||||
public Builder setErrorCode(int errorCode) {
|
||||
this.errorCode = errorCode;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setErrorMsg(String errorMsg) {
|
||||
this.errorMsg = errorMsg;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造器方法.
|
||||
*/
|
||||
public WxError build() {
|
||||
WxError wxError = new WxError();
|
||||
wxError.setErrorCode(this.errorCode);
|
||||
wxError.setErrorMsg(this.errorMsg);
|
||||
return wxError;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package me.chanjar.weixin.common.bean.result;
|
||||
|
||||
import lombok.Data;
|
||||
import me.chanjar.weixin.common.util.ToStringUtils;
|
||||
import me.chanjar.weixin.common.util.json.WxGsonBuilder;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class WxMediaUploadResult implements Serializable {
|
||||
private static final long serialVersionUID = 330834334738622341L;
|
||||
|
||||
@@ -17,38 +19,6 @@ public class WxMediaUploadResult implements Serializable {
|
||||
return WxGsonBuilder.create().fromJson(json, WxMediaUploadResult.class);
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return this.type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getMediaId() {
|
||||
return this.mediaId;
|
||||
}
|
||||
|
||||
public void setMediaId(String mediaId) {
|
||||
this.mediaId = mediaId;
|
||||
}
|
||||
|
||||
public long getCreatedAt() {
|
||||
return this.createdAt;
|
||||
}
|
||||
|
||||
public void setCreatedAt(long createdAt) {
|
||||
this.createdAt = createdAt;
|
||||
}
|
||||
|
||||
public String getThumbMediaId() {
|
||||
return this.thumbMediaId;
|
||||
}
|
||||
|
||||
public void setThumbMediaId(String thumbMediaId) {
|
||||
this.thumbMediaId = thumbMediaId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return ToStringUtils.toSimpleString(this);
|
||||
|
||||
Reference in New Issue
Block a user