@@ -2,6 +2,7 @@ package wu.seal.jsontokotlin
22
33import com.intellij.ide.util.PropertiesComponent
44import wu.seal.jsontokotlin.statistics.sendConfigInfo
5+ import wu.seal.jsontokotlin.supporter.GsonSupporter
56
67/* *
78 * ConfigManager
@@ -31,12 +32,18 @@ interface IConfigManager {
3132 get() = " jsonToKotlin_user_uuid_value_key"
3233
3334
35+ private val USER_CUSTOM_JSON_LIB_ANNOTATION_IMPORT_CLASS : String
36+ get() = " jsonToKotlin_user_custom_json_lib_annotation_import_class"
37+
38+ private val USER_CUSTOM_JSON_LIB_ANNOTATION_FORMAT_STRING : String
39+ get() = " jsontokotlin_user_custom_json_lib_annotation_format_string"
40+
3441 var isPropertiesVar: Boolean
3542 get() = if (isTestModel) TestConfig .isPropertiesVar else PropertiesComponent .getInstance().isTrueValue(IS_PROPERTIES_VAR_KEY )
3643 set(value) = if (isTestModel) {
3744 } else {
3845 PropertiesComponent .getInstance().setValue(IS_PROPERTIES_VAR_KEY , value)
39- Thread (){
46+ Thread () {
4047 sendConfigInfo()
4148 }.start()
4249 }
@@ -47,7 +54,7 @@ interface IConfigManager {
4754 set(value) = if (isTestModel) {
4855 } else {
4956 PropertiesComponent .getInstance().setValue(IS_COMMENT_OFF , value)
50- Thread (){
57+ Thread () {
5158 sendConfigInfo()
5259 }.start()
5360 }
@@ -56,9 +63,10 @@ interface IConfigManager {
5663 var targetJsonConverterLib: TargetJsonConverter
5764 get() = if (isTestModel) TestConfig .targetJsonConvertLib else TargetJsonConverter .valueOf(PropertiesComponent .getInstance().getValue(TARGET_JSON_CONVERTER_LIB_KEY ) ? : TargetJsonConverter .None .name)
5865 set(value) = if (isTestModel) {
66+ TestConfig .targetJsonConvertLib = value
5967 } else {
6068 PropertiesComponent .getInstance().setValue(TARGET_JSON_CONVERTER_LIB_KEY , value.name)
61- Thread (){
69+ Thread () {
6270 sendConfigInfo()
6371 }.start()
6472 }
@@ -68,7 +76,7 @@ interface IConfigManager {
6876 set(value) = if (isTestModel) {
6977 } else {
7078 PropertiesComponent .getInstance().setValue(IS_PROPERTY_NULLABLE_KEY , value)
71- Thread (){
79+ Thread () {
7280 sendConfigInfo()
7381 }.start()
7482 }
@@ -77,9 +85,9 @@ interface IConfigManager {
7785 var initWithDefaultValue: Boolean
7886 get() = if (isTestModel) TestConfig .initWithDefaultValue else PropertiesComponent .getInstance().getBoolean(INIT_WITH_DEFAULT_VALUE_KEY )
7987 set(value) = if (isTestModel) {
80- } else {
88+ } else {
8189 PropertiesComponent .getInstance().setValue(INIT_WITH_DEFAULT_VALUE_KEY , value)
82- Thread (){
90+ Thread () {
8391 sendConfigInfo()
8492 }.start()
8593 }
@@ -89,7 +97,27 @@ interface IConfigManager {
8997 set(value) = if (isTestModel) {
9098 } else {
9199 PropertiesComponent .getInstance().setValue(USER_UUID_KEY , value)
92- Thread (){
100+ Thread () {
101+ sendConfigInfo()
102+ }.start()
103+ }
104+
105+ var customAnnotaionImportClassString: String
106+ get() = if (isTestModel) GsonSupporter .annotationImportClassString else PropertiesComponent .getInstance().getValue(USER_CUSTOM_JSON_LIB_ANNOTATION_IMPORT_CLASS , GsonSupporter .annotationImportClassString)
107+ set(value) = if (isTestModel) {
108+ } else {
109+ PropertiesComponent .getInstance().setValue(USER_CUSTOM_JSON_LIB_ANNOTATION_IMPORT_CLASS , value)
110+ Thread () {
111+ sendConfigInfo()
112+ }.start()
113+ }
114+
115+ var customAnnotaionFormatString: String
116+ get() = if (isTestModel) GsonSupporter .anotaionOnProperty else PropertiesComponent .getInstance().getValue(USER_CUSTOM_JSON_LIB_ANNOTATION_FORMAT_STRING , GsonSupporter .anotaionOnProperty)
117+ set(value) = if (isTestModel) {
118+ } else {
119+ PropertiesComponent .getInstance().setValue(USER_CUSTOM_JSON_LIB_ANNOTATION_FORMAT_STRING , value)
120+ Thread () {
93121 sendConfigInfo()
94122 }.start()
95123 }
@@ -99,7 +127,7 @@ interface IConfigManager {
99127 * This means which Json convert library you are using in you project
100128 */
101129enum class TargetJsonConverter {
102- None , Gson , FastJson , Jackson
130+ None , Gson , FastJson , Jackson , MoShi , LoganSquare , Custom
103131}
104132
105133
@@ -116,7 +144,7 @@ var isTestModel = false
116144object TestConfig {
117145 var isCommentOff = false
118146 var isPropertiesVar = false
119- var targetJsonConvertLib = TargetJsonConverter .None
147+ var targetJsonConvertLib = TargetJsonConverter .Gson
120148 var isPropertyNullable = true
121149 var initWithDefaultValue = true
122150}
0 commit comments