HiSEN

IDEA设置intellij-java-google-style

一直想弄个格式化代码,后来发现很多人用谷歌的,于是也来整一份

保存一份google code的xml,链接有最新的
intellij-java-google-style.xml
设置方法如下:Setting -> Editor -> Code Stytle -> Java

最后一步就选择你存放之前保存的xml

然后就大功告成,来个对比

1
2
3
4
5
6
7
8
9
10
11
12
13
14
package com.hisen.json;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;

/**
* Created by hisenyuan on 2017/3/23 at 18:02.
*/
public class test {
public static void main(String[] args) {String s = "{'A':'a'}";
JSONObject obj= JSON.parseObject(s);
System.out.println(obj.get("A"));
}
}


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
package com.hisen.json;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;

/**
* Created by hisenyuan on 2017/3/23 at 18:02.
*/
public class test {

public static void main(String[] args) {
String s = "{'A':'a'}";
JSONObject obj = JSON.parseObject(s);
System.out.println(obj.get("A"));
}
}