1.Java
安装好插件之后,把Gson/Json数据复制一下,eg:
{
"Chrome": "UA-66061856-6",
"ChromePro": "UA-66061856-9",
"Opera": "UA-66061856-7",
"Edge": "UA-66061856-8",
"Firefox": "UA-66061856-10",
"Safari": "UA-66061856-16",
"SamsungInternet": "UA-66061856-19"
}
新建一个空白类,在这个位置右键出现菜单
菜单中选择Generate...
选择我们刚才安装的插件
然后把Gson/Json字符串拷贝进去
复制进去之后,会自动检测Gson/Json字符串的合法性,然后点击确定
class Test {
/**
* Chrome : UA-66061856-6
* ChromePro : UA-66061856-9
* Opera : UA-66061856-7
* Edge : UA-66061856-8
* Firefox : UA-66061856-10
* Safari : UA-66061856-16
* SamsungInternet : UA-66061856-19
*/
private String Chrome;
private String ChromePro;
private String Opera;
private String Edge;
private String Firefox;
private String Safari;
private String SamsungInternet;
public String getChrome() {
return Chrome;
}
public void setChrome(String Chrome) {
this.Chrome = Chrome;
}
public String getChromePro() {
return ChromePro;
}
public void setChromePro(String ChromePro) {
this.ChromePro = ChromePro;
}
public String getOpera() {
return Opera;
}
public void setOpera(String Opera) {
this.Opera = Opera;
}
public String getEdge() {
return Edge;
}
public void setEdge(String Edge) {
this.Edge = Edge;
}
public String getFirefox() {
return Firefox;
}
public void setFirefox(String Firefox) {
this.Firefox = Firefox;
}
public String getSafari() {
return Safari;
}
public void setSafari(String Safari) {
this.Safari = Safari;
}
public String getSamsungInternet() {
return SamsungInternet;
}
public void setSamsungInternet(String SamsungInternet) {
this.SamsungInternet = SamsungInternet;
}
}
这样就快速生成了我们需要的实体类。
2.Kotlin
新建一个空白类,
在文件的空白处右键
同样复制Gson/Json字符串
点击Generate,一键生成了Data
data class Test(
val Chrome: String,
val ChromePro: String,
val Edge: String,
val Firefox: String,
val Opera: String,
val Safari: String,
val SamsungInternet: String
)