1、首先在androidstudio插件中加入插件,如下图
二、添加jar包
//bean自动生成get/set/toString
provided 'org.projectlombok:lombok:1.16.16'
annotationProcessor "org.projectlombok:lombok:1.16.16"
provided 'org.glassfish:javax.annotation:10.0-b28'
三、bean中直接添加注解即可,如下bean
package com.hongdaoai.hdzy.fzzl.model.login;
import com.google.gson.annotations.SerializedName;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
/**
* Created by xi
* Class Note:
* 登录接口数据
*/
@Getter
@Setter
@ToString
public class LoginResponseBean {
@SerializedName("token")
private String token;
private String uid;
private String pwdChgFlg;
private int prescriptionFlg;
private int approvalFlg;
}
@Getter
@Setter
@ToString
public class LoginResponseBean {
@SerializedName("token")
private String token;
private String uid;
private String pwdChgFlg;
private int prescriptionFlg;
private int approvalFlg;
}
新版本android studio不能使用lombox插件,解决办法:https://www.phoene.com/279/