diff --git a/README.md b/README.md index c568c6e..0a13bc9 100644 --- a/README.md +++ b/README.md @@ -62,43 +62,62 @@ which is more flexible and convenient. | Field | use number key as map | 是 | 使用数字类型key替换为Map结构,待完善 | | Convert library | jackson/fastjson | 是 | jackson/fastjson等转换注解 | -#### 5.版本信息 +### 中文版 -future features +#### 5. 版本信息 -- 提取静态内部类到根类 -- 支持数字key映射Map字段 +**版本 1.6.2 by xweiba** +- 支持 FastJSON2 +- IDEA 插件升级到 1.5.2 版本 +- Gradle 插件升级到 7.1 版本 +- 更新 README -版本1.5.2 by wangzejun +**版本 1.6.1 by xweiba** +- 修复注释 NPE -- 支持字段注释 -- 支持json5格式 - -版本1.5.1 by sun-men - -- 设置默认为jackson注解 -- 支持选用lombok注解 -- 代码在新版本idea重构 +**版本 1.6.0 by wangzhejun** +- 支持自动格式化 +- 修复注释位置 +- 修复驼峰转换 -版本1.5.0 - 3 years ago +**版本 1.5.8 by wangzhejun** +- 修复 JSON 驼峰 Bug +- 修复布尔属性默认 `is` 函数 +- 修复注释冲突 -- fix several bug -- fix unlock setting window size +**版本 1.5.7 by wangzhejun** +- 修复部分 JSON5 格式 Bug -版本1.4.0 +**版本 1.5.6 by mars-men** +- 移除 JSON 对话框的 `VK_ENTER` 监听器 +- 更新 README -- New: Support for autovalue -- New: Support for lombok -- New: Support for split generate class +**版本 1.5.5 by mars-men** +- 上传到 JetBrains 插件中心 -版本1.2.2 - -- 支持 field 类型的修改. -- 支持快捷键打开 GsonFormat ,默认为 option+s(mac), alt+s(win) -- 支持 field 名称的修改. -- 支持添加 field 前缀. -- 支持多种转换库 (Gson,Jackjson,FastJson,LoganSquare). -- 支持 private 和 public 两种模式. -- 支持过滤父类已有属性. - -the end +**版本 1.5.2 by wangzejun** +- 支持字段注释 +- 支持 JSON5 格式 + +**版本 1.5.1 by sun-men** +- 设置默认为 Jackson 注解 +- 支持选用 Lombok 注解 +- 代码在新版本 IDEA 重构 + +**版本 1.5.0 - 3 年前** +- 修复多个 Bug +- 修复设置窗口大小锁定的问题 + +**版本 1.4.0** +- 新增:支持 Autovalue +- 新增:支持 Lombok +- 新增:支持拆分生成类 + +**版本 1.2.2** +- 支持字段类型的修改 +- 支持快捷键打开 GsonFormat,默认为 Option+S (Mac),Alt+S (Windows) +- 支持字段名称的修改 +- 支持添加字段前缀 +- 支持多种转换库 (Gson, Jackson, FastJSON, LoganSquare) +- 支持 private 和 public 两种模式 +- 支持过滤父类已有属性 diff --git a/README_EN.md b/README_EN.md index 172735d..b5b7f39 100644 --- a/README_EN.md +++ b/README_EN.md @@ -60,33 +60,60 @@ SETTING | Convert library | jackson/fastjson | true | jackson/fastjson convert library | +#### 5. Version Information -## Version Info +**Version 1.6.2 by xweiba** +- Support FastJSON2 +- Upgrade IDEA plugin to version 1.5.2 +- Upgrade Gradle plugin to version 7.1 +- Update README -1.5.5 by mars-men +**Version 1.6.1 by xweiba** +- Fix comment NPE -- upload to jetbrain plugin center +**Version 1.6.0 by wangzhejun** +- Support auto format +- Fix comment position +- Fix camel convert -1.5.2 by wangzejun +**Version 1.5.8 by wangzhejun** +- Fix JSON camel bug +- Fix boolean property default `is` function +- Fix comment conflict -- support field comment -- support json5 format +**Version 1.5.7 by wangzhejun** +- Fix some JSON5 format bugs -1.5.1 by mars-men +**Version 1.5.6 by mars-men** +- Remove JSON dialog `VK_ENTER` listener +- Update README -- setting jackson annotation as default -- support lombok as option -- fix some bug +**Version 1.5.5 by mars-men** +- Upload to JetBrains plugin center -1.5.0 - 3 years ago by gsonformat +**Version 1.5.2 by wangzejun** +- Support field comments +- Support JSON5 format -- fix several bug -- fix unlock setting window size +**Version 1.5.1 by sun-men** +- Set default to Jackson annotations +- Support using Lombok annotations +- Code refactored in new version of IDEA -1.4.0 +**Version 1.5.0 - 3 years ago** +- Fix several bugs +- Fix unlock setting window size -- New: Support for autovalue -- New: Support for lombok +**Version 1.4.0** +- New: Support for Autovalue +- New: Support for Lombok - New: Support for split generate class -the end \ No newline at end of file +**Version 1.2.2** +- Support field type modification +- Support opening GsonFormat with a shortcut, default is Option+S (Mac), Alt+S (Windows) +- Support field name modification +- Support adding field prefix +- Support multiple conversion libraries (Gson, Jackson, FastJSON, LoganSquare) +- Support private and public modes +- Support filtering out parent class properties diff --git a/build.gradle b/build.gradle index 5cac6a2..77c8618 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,7 @@ buildscript { repositories { mavenCentral() + maven { url "https://www.jetbrains.com/intellij-repository/releases" } maven { url "https://oss.sonatype.org/content/repositories/snapshots/" } @@ -11,7 +12,7 @@ buildscript { } plugins { - id 'org.jetbrains.intellij' version "0.4.21" + id 'org.jetbrains.intellij' version "1.5.2" } apply plugin: 'org.jetbrains.intellij' @@ -20,14 +21,17 @@ apply plugin: 'java' [compileJava, compileTestJava]*.options*.encoding = 'UTF-8' intellij { - plugins 'java' - version ideaVersion //debug version - pluginName 'GsonFormatPlus' - updateSinceUntilBuild false + version = project.ideaVersion + type = project.ideaType + plugins = [ + "java" + ] + pluginName = 'GsonFormatPlus' + updateSinceUntilBuild = false } -sourceCompatibility = javaVersion -targetCompatibility = javaVersion +sourceCompatibility = project.javaVersion +targetCompatibility = project.javaVersion repositories { mavenCentral() @@ -40,4 +44,3 @@ repositories { maven { url "https://www.jetbrains.com/intellij-repository/releases" } maven { url "https://www.jetbrains.com/intellij-repository/snapshots" } } - diff --git a/gradle.properties b/gradle.properties index 4ae06b1..ad8d0e7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,2 +1,3 @@ -javaVersion=1.8 -ideaVersion=IU-2019.3.5 +javaVersion=11 +ideaVersion=2019.3.5 +ideaType=IC diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 6623300..69a9715 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/java/com/foxsteps/gsonformat/ConvertBridge.java b/src/main/java/com/foxsteps/gsonformat/ConvertBridge.java index e6b3b01..2cdc568 100644 --- a/src/main/java/com/foxsteps/gsonformat/ConvertBridge.java +++ b/src/main/java/com/foxsteps/gsonformat/ConvertBridge.java @@ -285,6 +285,7 @@ public String getPackName(PsiClass psiClass) { * @return */ public String removeComment(String str) { + if (str == null) return ""; String temp = str.replaceAll("/\\*" + "[\\S\\s]*?" + "\\*/", ""); diff --git a/src/main/java/com/foxsteps/gsonformat/config/Config.java b/src/main/java/com/foxsteps/gsonformat/config/Config.java index b1b47af..f5630eb 100644 --- a/src/main/java/com/foxsteps/gsonformat/config/Config.java +++ b/src/main/java/com/foxsteps/gsonformat/config/Config.java @@ -167,6 +167,9 @@ public String geFullNameAnnotation() { if (annotationStr.equals(Constant.fastAnnotation)) { return Constant.fastFullNameAnnotation; } + if (annotationStr.equals(Constant.fast2Annotation)) { + return Constant.fast2FullNameAnnotation; + } if (annotationStr.equals(Constant.loganSquareAnnotation)) { return Constant.loganSquareFullNameAnnotation; } diff --git a/src/main/java/com/foxsteps/gsonformat/config/Constant.java b/src/main/java/com/foxsteps/gsonformat/config/Constant.java index 6daa2a2..269e3ba 100644 --- a/src/main/java/com/foxsteps/gsonformat/config/Constant.java +++ b/src/main/java/com/foxsteps/gsonformat/config/Constant.java @@ -88,6 +88,10 @@ public class Constant { public static final String fastAnnotation = "@com.alibaba.fastjson.annotation.JSONField\\s*\\(\\s*name\\s*=\\s*\"{filed}\"\\s*\\)"; + public static final String fast2FullNameAnnotation = "@com.alibaba.fastjson2.annotation.JSONField(name=\"{filed}\")"; + + public static final String fast2Annotation = "@com.alibaba.fastjson2.annotation.JSONField\\s*\\(\\s*name\\s*=\\s*\"{filed}\"\\s*\\)"; + public static final String jacksonAnnotation = "@com.fasterxml.jackson.annotation.JsonProperty\\s*\\(\\s*\"{filed}\"\\s*\\)"; public static final String loganSquareAnnotation = "@com.bluelinelabs.logansquare.annotation.JsonField\\s*\\(\\s*name\\s*=\\s*\"{filed}\"\\s*\\)"; diff --git a/src/main/java/com/foxsteps/gsonformat/ui/SettingDialog.form b/src/main/java/com/foxsteps/gsonformat/ui/SettingDialog.form index 7cef39c..6eeb4ae 100644 --- a/src/main/java/com/foxsteps/gsonformat/ui/SettingDialog.form +++ b/src/main/java/com/foxsteps/gsonformat/ui/SettingDialog.form @@ -148,7 +148,7 @@ - + @@ -160,7 +160,7 @@ - + @@ -169,7 +169,7 @@ - + @@ -178,7 +178,7 @@ - + @@ -187,7 +187,7 @@ - + @@ -195,7 +195,7 @@ - + @@ -219,6 +219,14 @@ + + + + + + + + @@ -477,6 +485,7 @@ + diff --git a/src/main/java/com/foxsteps/gsonformat/ui/SettingDialog.java b/src/main/java/com/foxsteps/gsonformat/ui/SettingDialog.java index 7c8ddbc..0917f85 100644 --- a/src/main/java/com/foxsteps/gsonformat/ui/SettingDialog.java +++ b/src/main/java/com/foxsteps/gsonformat/ui/SettingDialog.java @@ -48,6 +48,7 @@ public class SettingDialog extends JFrame { private JRadioButton gsonRB; private JRadioButton jacksonRB; private JRadioButton fastJsonRB; + private JRadioButton fastJson2RB; private JRadioButton otherRB; private JRadioButton loganSquareRB; private JRadioButton autoValueRB; @@ -231,6 +232,27 @@ public void actionPerformed(ActionEvent actionEvent) { array1Button.setEnabled(false); } }); + fastJson2RB.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent actionEvent) { + if (fastJson2RB.isSelected()) { + annotationTF.setText(Constant.fast2Annotation); + } + annotationTF.setEnabled(false); + objectFromDataCB.setEnabled(false); + objectFromDataCB.setSelected(false); + objectFromData1CB.setEnabled(false); + objectFromData1CB.setSelected(false); + arrayFromDataCB.setEnabled(false); + arrayFromDataCB.setSelected(false); + arrayFromData1CB.setEnabled(false); + arrayFromData1CB.setSelected(false); + objectButton.setEnabled(false); + object1Button.setEnabled(false); + arrayButton.setEnabled(false); + array1Button.setEnabled(false); + } + }); loganSquareRB.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { @@ -308,6 +330,9 @@ public void actionPerformed(ActionEvent actionEvent) { } else if (annotaionStr.equals(Constant.fastAnnotation)) { fastJsonRB.setSelected(true); annotationTF.setEnabled(false); + } else if (annotaionStr.equals(Constant.fast2Annotation)) { + fastJson2RB.setSelected(true); + annotationTF.setEnabled(false); } else if (annotaionStr.equals(Constant.jacksonAnnotation)) { jacksonRB.setSelected(true); annotationTF.setEnabled(false); diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index a89507d..d461ad9 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -1,6 +1,6 @@ GsonFormatPlus - 1.6.1 + 1.6.2 @@ -57,6 +57,18 @@ which is base on GsonFormat and more flexible and convenient. Welcome to issue a

 

Version Info

+

1.6.2 by xweiba

+
    +
  • support fastjson2
  • +
  • update idea plugin
  • +
  • update readme
  • +
+ +

1.6.1 by xweiba

+
    +
  • fix comment npe
  • +
+

1.6.0 by wangzhejun

  • support auto format
  • @@ -121,11 +133,39 @@ which is base on GsonFormat and more flexible and convenient. Welcome to issue a mars-men 1.6.2

    +
      +
    • support fastjson2
    • +
    • update idea plugin
    • +
    • update readme
    • +
    + +

    1.6.1

    +
      +
    • support auto format
    • +
    • fix comment npe
    • +
    • fix comment position
    • +
    • fix camel convert
    • +
    +

    1.6.0

      -
    • support auto format
    • -
    • fix comment position
    • -
    • fix camel convert
    • +
    • support auto format
    • +
    • fix comment position
    • +
    • fix camel convert
    • +
    + +

    1.5.8

    +
      +
    • fix json camel bug
    • +
    • fix bool property default `is` function
    • +
    • fix comment conflict
    • +
    + +

    1.5.7

    +
      +
    • fix some json5 format bug

    1.5.6

    @@ -171,4 +211,4 @@ which is base on GsonFormat and more flexible and convenient. Welcome to issue a com.intellij.modules.java - \ No newline at end of file +