声明:此文纯记录用,没有什么技术含量。
GsonFormat作用:根据Gson库使用的要求,将JSONObject格式的String 解析成实体。
GsonFormat的github地址:https://github.com/zzz40500/GsonFormat
GsonFormat安装:Androidstudio的差距的安装都是一样的。
方法一:
1.Android studio
File->Settings..->Plugins-->Browse repositores..搜索GsonFormat
2.安装插件,重启android studio
方法二:
1.下载 GsonFormat.jar ,下载地址(其实插件的jar包都可以在这儿下载):https://plugins.jetbrains.com/plugin/7654?pr=androidstudio
2.Android studio File->Settings..->Plugins -->
install plugin from disk..导入下载的 GsonFormat.jar ,
3.重启 android studio.
GsonFormat的使用:
Alt+insert-->gsonformat
弹出框的那一栏gsonformat旁边又个alt+s就说明我下次打开格式化的的时候就直接用alt+s就Ok了。
先来个简单的。
右上角的format可以进行格式化的。在转换时候自己可以对类型是可以修改的。里面的setting也是可以设置的。
说明:gsonformat插件是能够识别注释的//和/***/,下面这种格式也能够正确转换的。
下面来点数据格式比较复杂的,即使复杂也能够转换得,有木有很强大。
基本的用法就到这里就结束了,赶紧动起来吧。来试试这个强大过的工具。如果大家在使用的时候遇到问题可以直接问我,也可以直接去https://github.com/zzz40500/GsonFormat/issues提问作者。
补充
github参考步骤:http://android-arsenal.com/details/1/1896
写在前头:本插件只适用 android studio和 Intellij IDEA 工具,eclipse 的少年无视我吧!!!
这是一个根据JSONObject格式的字符串,自动生成实体类参数.
写在前头:本插件只适用 android studio和 Intellij IDEA 工具!!!
版本说明
v1.2.2 (English)
- Support field type changes.
- Support shortcut to open GsonFormat, default option + s (mac), alt + s (win)
- Support for field name changes.
- Support add the prefix field.
- Support for multiple conversion library (Gson, Jackjson, FastJson, LoganSquare).
- Support private and public modes.
- Support Filter superclass an existing fields.
版本1.2.2 (中文)
- 支持 field 类型的修改.
- 支持快捷键打开 GsonFormat ,默认为 option+s(mac), alt+s(win)
- 支持 field 名称的修改.
- 支持添加 field 前缀.
- 支持多种转换库 (Gson,Jackjson,FastJson,LoganSquare).
- 支持 private 和 public 两种模式.
- 支持过滤父类已有属性.
安装方法
方法1:
1.Android studio
File->Settings..->Plugins-->Browse repositores..搜索GsonFormat
2.安装插件,重启android studio
方法2:下载地址
1.下载 GsonFormat.jar ,
2.Android studio File->Settings..->Plugins -->
install plugin from disk..导入下载的 GsonFormat.jar ,
3重启 android studio .
打开方法
使用截图