支持 2018.3 版本
修改部分字段丢失的问题
This commit is contained in:
parent
00076c7266
commit
d0dd90adb4
@ -4,7 +4,7 @@ plugins {
|
||||
}
|
||||
|
||||
group 'com.liuzhihang.toolkit'
|
||||
version '1.0.3'
|
||||
version '1.0.4'
|
||||
|
||||
sourceCompatibility = 1.8
|
||||
|
||||
|
||||
@ -1,11 +1,13 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf8">
|
||||
<ul>
|
||||
<li>1.0.3
|
||||
<li>1.0.4
|
||||
<ol>
|
||||
<li>优化代码</li>
|
||||
<li>修复部分字段丢失的bug</li>
|
||||
<li>修改支持 2018.3 及以上版本</li>
|
||||
</ol>
|
||||
<ol>
|
||||
<li>Optimized code</li>
|
||||
<li>Fix the bug that some fields are missing</li>
|
||||
<li>Modified support 2018.3 and above</li>
|
||||
</ol>
|
||||
</li>
|
||||
|
||||
|
||||
@ -23,6 +23,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
import java.awt.*;
|
||||
import java.awt.datatransfer.Clipboard;
|
||||
import java.awt.datatransfer.StringSelection;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
@ -52,7 +53,7 @@ public class CopyAsJsonAction extends AnAction {
|
||||
PROPERTIES_TYPES.put("Boolean", false);
|
||||
// 其他
|
||||
PROPERTIES_TYPES.put("String", "");
|
||||
PROPERTIES_TYPES.put("BigDecimal", null);
|
||||
PROPERTIES_TYPES.put("BigDecimal", BigDecimal.ZERO);
|
||||
PROPERTIES_TYPES.put("Date", null);
|
||||
PROPERTIES_TYPES.put("LocalDate", null);
|
||||
PROPERTIES_TYPES.put("LocalTime", null);
|
||||
@ -85,7 +86,7 @@ public class CopyAsJsonAction extends AnAction {
|
||||
try {
|
||||
Map<String, Object> fieldsMap = getFields(selectedClass);
|
||||
|
||||
Gson gson = new GsonBuilder().create();
|
||||
Gson gson = new GsonBuilder().serializeNulls().create();
|
||||
String json = GsonFormatUtil.gsonFormat(gson, fieldsMap);
|
||||
|
||||
// 使用自定义缩进格式 String json = new GsonBuilder().setPrettyPrinting().create().toJson(fieldsMap);
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
|
||||
<actions>
|
||||
<action id="Toolkit.Json.CopyAsJsonAction" class="com.liuzhihang.toolkit.action.CopyAsJsonAction"
|
||||
text="CopyAsJsonAction" description="Copy As Json">
|
||||
text="Copy As Json" description="Copy Java Bean as json string">
|
||||
<add-to-group group-id="EditorPopupMenu" anchor="first"/>
|
||||
<keyboard-shortcut keymap="$default" first-keystroke="shift meta J"/>
|
||||
</action>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user