插件GsonFormat 是用来生成javaBean,方便我们使用Gson来解析数据库返回给我们复杂的字符串
操作步骤:
(1)图中有标号,可根据1、2、3的步骤来下载GsonFormat
2.自己写一个类,我以TestBean为例
3.在TestBean中点击鼠标右键会出现菜单选择Generate(或者快捷键Alt+Insert)
4.选择GsonFormat,会弹出如下
5.把服务器返回的字符串复制到框框中
6.点击OK,生成如下:
可以看出这个界面是可选择性的,可根据需要选择或者全部选择,点击ok可生成TestBean
7.生成的TestBean如下:
public class TestBean { private TlampBlackHistoryPOBean tlampBlackHistoryPO; private int code; private String msg; private List<YouYanDataBean> youYanData; public TlampBlackHistoryPOBean getTlampBlackHistoryPO() { return tlampBlackHistoryPO; } public void setTlampBlackHistoryPO(TlampBlackHistoryPOBean tlampBlackHistoryPO) { this.tlampBlackHistoryPO = tlampBlackHistoryPO; } public int getCode() { return code; } public void setCode(int code) { this.code = code; } public String getMsg() { return msg; } public void setMsg(String msg) { this.msg = msg; } public List<YouYanDataBean> getYouYanData() { return youYanData; } public void setYouYanData(List<YouYanDataBean> youYanData) { this.youYanData = youYanData; } public static class TlampBlackHistoryPOBean { private String lat; private String lng; private String pointName; private String pointType; private Object pointId; private String id; private String modulecode; private String moduleid; private String mname; private double concentration; private long recdate; private String recdateStr; private int purifierstate; private int blowerstate; private double temp; private double hum; private int cleanliness; private int conlimit; private int systemstate; private Object pointnum; public String getLat() { return lat; } public void setLat(String lat) { this.lat = lat; } public String getLng() { return lng; } public void setLng(String lng) { this.lng = lng; } public String getPointName() { return pointName; } public void setPointName(String pointName) { this.pointName = pointName; } public String getPointType() { return pointType; } public void setPointType(String pointType) { this.pointType = pointType; } public Object getPointId() { return pointId; } public void setPointId(Object pointId) { this.pointId = pointId; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getModulecode() { return modulecode; } public void setModulecode(String modulecode) { this.modulecode = modulecode; } public String getModuleid() { return moduleid; } public void setModuleid(String moduleid) { this.moduleid = moduleid; } public String getMname() { return mname; } public void setMname(String mname) { this.mname = mname; } public double getConcentration() { return concentration; } public void setConcentration(double concentration) { this.concentration = concentration; } public long getRecdate() { return recdate; } public void setRecdate(long recdate) { this.recdate = recdate; } public String getRecdateStr() { return recdateStr; } public void setRecdateStr(String recdateStr) { this.recdateStr = recdateStr; } public int getPurifierstate() { return purifierstate; } public void setPurifierstate(int purifierstate) { this.purifierstate = purifierstate; } public int getBlowerstate() { return blowerstate; } public void setBlowerstate(int blowerstate) { this.blowerstate = blowerstate; } public double getTemp() { return temp; } public void setTemp(double temp) { this.temp = temp; } public double getHum() { return hum; } public void setHum(double hum) { this.hum = hum; } public int getCleanliness() { return cleanliness; } public void setCleanliness(int cleanliness) { this.cleanliness = cleanliness; } public int getConlimit() { return conlimit; } public void setConlimit(int conlimit) { this.conlimit = conlimit; } public int getSystemstate() { return systemstate; } public void setSystemstate(int systemstate) { this.systemstate = systemstate; } public Object getPointnum() { return pointnum; } public void setPointnum(Object pointnum) { this.pointnum = pointnum; } } public static class YouYanDataBean { private Object lat; private Object lng; private Object pointName; private Object pointType; private Object pointId; private Object id; private Object modulecode; private Object moduleid; private String mname; private double concentration; private long recdate; private String recdateStr; private Object purifierstate; private Object blowerstate; private double temp; private double hum; private Object cleanliness; private Object conlimit; private Object systemstate; private Object pointnum; public Object getLat() { return lat; } public void setLat(Object lat) { this.lat = lat; } public Object getLng() { return lng; } public void setLng(Object lng) { this.lng = lng; } public Object getPointName() { return pointName; } public void setPointName(Object pointName) { this.pointName = pointName; } public Object getPointType() { return pointType; } public void setPointType(Object pointType) { this.pointType = pointType; } public Object getPointId() { return pointId; } public void setPointId(Object pointId) { this.pointId = pointId; } public Object getId() { return id; } public void setId(Object id) { this.id = id; } public Object getModulecode() { return modulecode; } public void setModulecode(Object modulecode) { this.modulecode = modulecode; } public Object getModuleid() { return moduleid; } public void setModuleid(Object moduleid) { this.moduleid = moduleid; } public String getMname() { return mname; } public void setMname(String mname) { this.mname = mname; } public double getConcentration() { return concentration; } public void setConcentration(double concentration) { this.concentration = concentration; } public long getRecdate() { return recdate; } public void setRecdate(long recdate) { this.recdate = recdate; } public String getRecdateStr() { return recdateStr; } public void setRecdateStr(String recdateStr) { this.recdateStr = recdateStr; } public Object getPurifierstate() { return purifierstate; } public void setPurifierstate(Object purifierstate) { this.purifierstate = purifierstate; } public Object getBlowerstate() { return blowerstate; } public void setBlowerstate(Object blowerstate) { this.blowerstate = blowerstate; } public double getTemp() { return temp; } public void setTemp(double temp) { this.temp = temp; } public double getHum() { return hum; } public void setHum(double hum) { this.hum = hum; } public Object getCleanliness() { return cleanliness; } public void setCleanliness(Object cleanliness) { this.cleanliness = cleanliness; } public Object getConlimit() { return conlimit; } public void setConlimit(Object conlimit) { this.conlimit = conlimit; } public Object getSystemstate() { return systemstate; } public void setSystemstate(Object systemstate) { this.systemstate = systemstate; } public Object getPointnum() { return pointnum; } public void setPointnum(Object pointnum) { this.pointnum = pointnum; } } }
点击查看更多内容
为 TA 点赞
评论
共同学习,写下你的评论
评论加载中...
作者其他优质文章
正在加载中
感谢您的支持,我会继续努力的~
扫码打赏,你说多少就多少
赞赏金额会直接到老师账户
支付方式
打开微信扫一扫,即可进行扫码打赏哦