Androidstudio plug-in Gsonformat fast implementation JavaBean

Source: Internet
Author: User

installation

Method One:

1.Android Studio File->settings. ->plugins–>browse Repositores. Search Gsonformat
2. Install the plugin and restart Android Studio

Method Two:

1. Download Gsonformat.jar;
2.Android Studio File->settings. ->plugins–>install plugin from disk. Import Download Gsonformat.jar
3. Restart Android Studio

How to use

Use the Generate shortcut key in the entity class.
Shortcut keys: The selected part of the diagram

Simple entity classes

Simple JSON format in the diagram

{
"Name": "Harry",
"Gender": "Man",
"Age": 15,
"Height": "140cm",
}

Build Result:

Package zhangxueyuan.myapplication;/** * created by xueyuan on 2015/6/15.  */public class bean  {    /**     *  height : 140cm     * age : 15      * name :  Harry      * gender : man      */    private string height;    private int  age;    private string name;    private string  gender;    public void setheight (string height)  {         this.height = height;    }     public void setage (int age)  {         this.age = age;    }    public void setname (String name)  {         this.name = name;    }     public void setgender (String gender)  {         this.gender = gender;    }    public String  GetHeight ()  {        return height;    }     public int getage ()  {         Return age;    }    public string getname ()  {         return name;    }     public string getgender ()  {        return  gender;    }} 

Found no need to inherit jsonmodle.

Complex situation will not write, you can see the original address, the personal feel because some reuse, generally will not be written like that.


Androidstudio plug-in Gsonformat fast implementation JavaBean

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.