Skip to content

Commit e007a13

Browse files
committed
使用lombok的@DaTa注解简化miniapp模块的所有bean类
1 parent e9ef9eb commit e007a13

File tree

12 files changed

+39
-549
lines changed

12 files changed

+39
-549
lines changed
Lines changed: 5 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
package cn.binarywang.wx.miniapp.bean;
22

3+
import lombok.AllArgsConstructor;
4+
import lombok.Data;
5+
36
/**
47
* <pre>
58
* lineColor 包装类
@@ -8,36 +11,8 @@
811
* </pre>
912
* @author Element
1013
*/
14+
@Data
15+
@AllArgsConstructor
1116
public class WxMaCodeLineColor {
1217
private String r = "0", g = "0", b = "0";
13-
14-
public WxMaCodeLineColor(String r, String g, String b) {
15-
this.r = r;
16-
this.g = g;
17-
this.b = b;
18-
}
19-
20-
public String getR() {
21-
return r;
22-
}
23-
24-
public void setR(String r) {
25-
this.r = r;
26-
}
27-
28-
public String getG() {
29-
return g;
30-
}
31-
32-
public void setG(String g) {
33-
this.g = g;
34-
}
35-
36-
public String getB() {
37-
return b;
38-
}
39-
40-
public void setB(String b) {
41-
this.b = b;
42-
}
4318
}

weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/WxMaJscode2SessionResult.java

Lines changed: 4 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import cn.binarywang.wx.miniapp.util.json.WxMaGsonBuilder;
44
import com.google.gson.annotations.SerializedName;
5+
import lombok.Data;
6+
import lombok.EqualsAndHashCode;
57

68
import java.io.Serializable;
79

@@ -10,6 +12,8 @@
1012
*
1113
* @author <a href="https://github.com/binarywang">Binary Wang</a>
1214
*/
15+
@Data
16+
@EqualsAndHashCode(callSuper = false)
1317
public class WxMaJscode2SessionResult implements Serializable {
1418
private static final long serialVersionUID = -1060216618475607933L;
1519

@@ -29,36 +33,4 @@ public static WxMaJscode2SessionResult fromJson(String json) {
2933
return WxMaGsonBuilder.create().fromJson(json, WxMaJscode2SessionResult.class);
3034
}
3135

32-
public String getSessionKey() {
33-
return sessionKey;
34-
}
35-
36-
public void setSessionKey(String sessionKey) {
37-
this.sessionKey = sessionKey;
38-
}
39-
40-
public Integer getExpiresin() {
41-
return expiresin;
42-
}
43-
44-
public void setExpiresin(Integer expiresin) {
45-
this.expiresin = expiresin;
46-
}
47-
48-
public String getOpenid() {
49-
return openid;
50-
}
51-
52-
public void setOpenid(String openid) {
53-
this.openid = openid;
54-
}
55-
56-
public String getUnionid() {
57-
return unionid;
58-
}
59-
60-
public void setUnionid(String unionid) {
61-
this.unionid = unionid;
62-
}
63-
6436
}

weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/WxMaKefuMessage.java

Lines changed: 2 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import cn.binarywang.wx.miniapp.builder.ImageBuilder;
44
import cn.binarywang.wx.miniapp.builder.TextBuilder;
55
import cn.binarywang.wx.miniapp.util.json.WxMaGsonBuilder;
6+
import lombok.Data;
67

78
import java.io.Serializable;
89

@@ -11,6 +12,7 @@
1112
*
1213
* @author <a href="https://github.com/binarywang">Binary Wang</a>
1314
*/
15+
@Data
1416
public class WxMaKefuMessage implements Serializable {
1517
private static final long serialVersionUID = -9196732086954365246L;
1618

@@ -36,62 +38,6 @@ public static ImageBuilder newImageBuilder() {
3638
return new ImageBuilder();
3739
}
3840

39-
public String getToUser() {
40-
return this.toUser;
41-
}
42-
43-
public void setToUser(String toUser) {
44-
this.toUser = toUser;
45-
}
46-
47-
public String getMsgType() {
48-
return this.msgType;
49-
}
50-
51-
public void setMsgType(String msgType) {
52-
this.msgType = msgType;
53-
}
54-
55-
public String getContent() {
56-
return this.content;
57-
}
58-
59-
public void setContent(String content) {
60-
this.content = content;
61-
}
62-
63-
public String getMediaId() {
64-
return this.mediaId;
65-
}
66-
67-
public void setMediaId(String mediaId) {
68-
this.mediaId = mediaId;
69-
}
70-
71-
public String getThumbMediaId() {
72-
return this.thumbMediaId;
73-
}
74-
75-
public void setThumbMediaId(String thumbMediaId) {
76-
this.thumbMediaId = thumbMediaId;
77-
}
78-
79-
public String getTitle() {
80-
return this.title;
81-
}
82-
83-
public void setTitle(String title) {
84-
this.title = title;
85-
}
86-
87-
public String getDescription() {
88-
return this.description;
89-
}
90-
91-
public void setDescription(String description) {
92-
this.description = description;
93-
}
94-
9541
public String toJson() {
9642
return WxMaGsonBuilder.create().toJson(this);
9743
}

weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/WxMaMessage.java

Lines changed: 2 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import com.google.gson.annotations.SerializedName;
88
import com.thoughtworks.xstream.annotations.XStreamAlias;
99
import com.thoughtworks.xstream.annotations.XStreamConverter;
10+
import lombok.Data;
1011
import me.chanjar.weixin.common.util.ToStringUtils;
1112
import me.chanjar.weixin.common.util.xml.XStreamCDataConverter;
1213
import org.apache.commons.io.IOUtils;
@@ -20,6 +21,7 @@
2021
* @author <a href="https://github.com/binarywang">Binary Wang</a>
2122
*/
2223
@XStreamAlias("xml")
24+
@Data
2325
public class WxMaMessage implements Serializable {
2426
private static final long serialVersionUID = -3586245291677274914L;
2527

@@ -146,91 +148,4 @@ public String toJson() {
146148
return WxMaGsonBuilder.create().toJson(this);
147149
}
148150

149-
public String getToUser() {
150-
return toUser;
151-
}
152-
153-
public void setToUser(String toUser) {
154-
this.toUser = toUser;
155-
}
156-
157-
public String getFromUser() {
158-
return fromUser;
159-
}
160-
161-
public void setFromUser(String fromUser) {
162-
this.fromUser = fromUser;
163-
}
164-
165-
public Integer getCreateTime() {
166-
return createTime;
167-
}
168-
169-
public void setCreateTime(Integer createTime) {
170-
this.createTime = createTime;
171-
}
172-
173-
public String getMsgType() {
174-
return msgType;
175-
}
176-
177-
public void setMsgType(String msgType) {
178-
this.msgType = msgType;
179-
}
180-
181-
public String getContent() {
182-
return content;
183-
}
184-
185-
public void setContent(String content) {
186-
this.content = content;
187-
}
188-
189-
public Long getMsgId() {
190-
return msgId;
191-
}
192-
193-
public void setMsgId(Long msgId) {
194-
this.msgId = msgId;
195-
}
196-
197-
public String getPicUrl() {
198-
return picUrl;
199-
}
200-
201-
public void setPicUrl(String picUrl) {
202-
this.picUrl = picUrl;
203-
}
204-
205-
public String getMediaId() {
206-
return mediaId;
207-
}
208-
209-
public void setMediaId(String mediaId) {
210-
this.mediaId = mediaId;
211-
}
212-
213-
public String getEvent() {
214-
return event;
215-
}
216-
217-
public void setEvent(String event) {
218-
this.event = event;
219-
}
220-
221-
public String getSessionFrom() {
222-
return sessionFrom;
223-
}
224-
225-
public void setSessionFrom(String sessionFrom) {
226-
this.sessionFrom = sessionFrom;
227-
}
228-
229-
public String getEncrypt() {
230-
return encrypt;
231-
}
232-
233-
public void setEncrypt(String encrypt) {
234-
this.encrypt = encrypt;
235-
}
236151
}

weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/WxMaQrcode.java

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
package cn.binarywang.wx.miniapp.bean;
22

33
import cn.binarywang.wx.miniapp.util.json.WxMaGsonBuilder;
4+
import lombok.Data;
5+
import lombok.EqualsAndHashCode;
46

57
import java.io.Serializable;
68

79
/**
810
* @author <a href="https://github.com/binarywang">Binary Wang</a>
911
*/
12+
@Data
13+
@EqualsAndHashCode(callSuper = false)
1014
public class WxMaQrcode extends AbstractWxMaQrcodeWrapper implements Serializable {
1115
private static final long serialVersionUID = 5777119669111011584L;
1216
private String path;
@@ -21,22 +25,6 @@ public static WxMaQrcode fromJson(String json) {
2125
return WxMaGsonBuilder.create().fromJson(json, WxMaQrcode.class);
2226
}
2327

24-
public String getPath() {
25-
return path;
26-
}
27-
28-
public void setPath(String path) {
29-
this.path = path;
30-
}
31-
32-
public int getWidth() {
33-
return width;
34-
}
35-
36-
public void setWidth(int width) {
37-
this.width = width;
38-
}
39-
4028
@Override
4129
public String toString() {
4230
return WxMaGsonBuilder.create().toJson(this);

0 commit comments

Comments
 (0)