Android studio 插件之 GsonFormat (自动生成javabean)

本文介绍了如何利用Android Studio的GsonFormat插件,自动生成JavaBean类,以便于解析复杂的JSON数据,例如MessageGroupEntity的实体类结构。
摘要由CSDN通过智能技术生成

public class MessageGroupEntity {

/**

  • retval : ok

  • reterr :

  • retinfo : {“count”:2,“groups”:[{“groupid”:1,“title”:“新朋友”,

  • “icon”:“http://aliimg.yizhibo.tv/online/message/2f/74/hi.png”,“type”:“1”,“readcnt”:67,

  • “unread”:2,“total”:19,“update_time”:“2016-04-05 09:11:09”,“lastest_content”:{“type”:2,

  • “data”:{“name”:“16837286”,“nickname”:“阿莲”,“gender”:“female”,“signature”:"",“vip”:“0”,

  • “logourl”:“http://aliimg.yizhibo.tv/online/user/2c/17/60ec3f44e8a0de9db1d87f1a59875ce1.jpg@100h_100w_90Q_0e_1c”}}}

  • ,{“groupid”:0,“title”:“易直播小秘书”,“icon”:“http://aliimg.yizhibo.tv/online/message/07/fd/Secretary.png”,“type”:0,“readcnt”:86,

  • “unread”:0,“total”:86,“update_time”:“2016-04-01 00:09:28”,

  • “lastest_content”:{“type”:0,“data”:{“text”:"愚人节来临之际,心中的小恶魔正在骚动。易直播愚人节无敌大王争霸集结号也借势邪恶吹响!

  • 看各大家如何大施迷魂阵,斗志斗勇,戎马而归。\u201c愚人大王\u201d、\u201c范二大王\u201d究竟花落谁家呢?咱们拭目以待!"}}}]}

*/

priv

《Android学习笔记总结+最新移动架构视频+大厂安卓面试真题+项目实战源码讲义》

【docs.qq.com/doc/DSkNLaERkbnFoS0ZF】 完整内容开源分享

ate String retval;

private String reterr;

/**

  • count : 2

  • groups : [{“groupid”:1,“title”:“新朋友”,

  • “icon”:“http://aliimg.yizhibo.tv/online/message/2f/74/hi.png”,“type”:“1”,“readcnt”:67,

  • “unread”:2,“total”:19,“update_time”:“2016-04-05 09:11:09”,

  • “lastest_content”:{“type”:2,“data”:{“name”:“16837286”,“nickname”:“阿莲”,“gender”:“female”,

  • “signature”:"",“vip”:“0”,“logourl”:“http://aliimg.yizhibo.tv/online/user/2c/17/60ec3f44e8a0de9db1d87f1a59875ce1.jpg@100h_100w_90Q_0e_1c”}}},

  • {“groupid”:0,“title”:“易直播小秘书”,“icon”:“http://aliimg.yizhibo.tv/online/message/07/fd/Secretary.png”,

  • “type”:0,“readcnt”:86,“unread”:0,“total”:86,“update_time”:“2016-04-01 00:09:28”,“lastest_content”:

  • {“type”:0,“data”:{“text”:"愚人节来临之际,心中的小恶魔正在骚动。易直播愚人节无敌大王争霸集结号也借势邪恶吹响!看各大家如何大施迷魂阵,斗志斗勇,戎马而归。

  • \u201c愚人大王\u201d、\u201c范二大王\u201d究竟花落谁家呢?咱们拭目以待!"}}}]

*/

private RetinfoEntity retinfo;

public void setRetval(String retval) {

this.retval = retval;

}

public void setReterr(String reterr) {

this.reterr = reterr;

}

public void setRetinfo(RetinfoEntity retinfo) {

this.retinfo = retinfo;

}

public String getRetval() {

return retval;

}

public String getReterr() {

return reterr;

}

public RetinfoEntity getRetinfo() {

return retinfo;

}

public static class RetinfoEntity {

private int count;

/**

  • groupid : 1

  • title : 新朋友

  • icon : http://aliimg.yizhibo.tv/online/message/2f/74/hi.png

  • type : 1

  • readcnt : 67

  • unread : 2

  • total : 19

  • update_time : 2016-04-05 09:11:09

  • lastest_content : {“type”:2,“data”:{“name”:“16837286”,“nickname”:“阿莲”,“gender”:“female”,“signature”:"",“vip”:“0”,“logourl”:“http://aliimg.yizhibo.tv/online/user/2c/17/60ec3f44e8a0de9db1d87f1a59875ce1.jpg@100h_100w_90Q_0e_1c”}}

*/

private List groups;

public void setCount(int count) {

this.count = count;

}

public void setGroups(List groups) {

this.groups = groups;

}

public int getCount() {

return count;

}

public List getGroups() {

return groups;

}

public static class GroupsEntity {

private int groupid;

private String title;

private String icon;

private String type;

private int readcnt;

private int unread;

private int total;

private String update_time;

/**

  • type : 2

  • data : {“name”:“16837286”,“nickname”:“阿莲”,“gender”:“female”,“signature”:"",“vip”:“0”,“logourl”:“http://aliimg.yizhibo.tv/online/user/2c/17/60ec3f44e8a0de9db1d87f1a59875ce1.jpg@100h_100w_90Q_0e_1c”}

*/

private LastestContentEntity lastest_content;

public void setGroupid(int groupid) {

this.groupid = groupid;

}

public void setTitle(String title) {

this.title = title;

}

public void setIcon(String icon) {

this.icon = icon;

}

public void setType(String type) {

this.type = type;

}

public void setReadcnt(int readcnt) {

this.readcnt = readcnt;

}

public void setUnread(int unread) {

this.unread = unread;

}

public void setTotal(int total) {

this.total = total;

}

public void setUpdate_time(String update_time) {

this.update_time = update_time;

}

public void setLastest_content(LastestContentEntity lastest_content) {

this.lastest_content = lastest_content;

}

public int getGroupid() {

return groupid;

}

public String getTitle() {

return title;

}

public String getIcon() {

return icon;

}

public String getType() {

return type;

}

public int getReadcnt() {

return readcnt;

}

public int getUnread() {

return unread;

}

public int getTotal() {

return total;

}

public String getUpdate_time() {

return update_time;

}

public LastestContentEntity getLastest_content() {

return lastest_content;

}

public static class LastestContentEntity {

private int type;

/**

  • name : 16837286

  • nickname : 阿莲

  • gender : female

  • signature :

  • vip : 0

  • logourl : http://aliimg.yizhibo.tv/online/user/2c/17/60ec3f44e8a0de9db1d87f1a59875ce1.jpg@100h_100w_90Q_0e_1c

*/

private DataEntity data;

public void setType(int type) {

this.type = type;

}

public void setData(DataEntity data) {

this.data = data;

}

public int getType() {

return type;

}

public DataEntity getData() {

return data;

}

public static class DataEntity {

private String name;

private String nickname;

private String gender;

private String signature;

private String vip;

private String logourl;

public void setName(String name) {

this.name = name;

}

public void setNickname(String nickname) {

this.nickname = nickname;

}

public void setGender(String gender) {

this.gender = gender;

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值