Skip to content

Commit f0c8d5c

Browse files
author
seal
committed
Optimize package name declare in source code
Fix custom annotation doesn't work when second update
1 parent ccd3a8c commit f0c8d5c

File tree

8 files changed

+21
-18
lines changed

8 files changed

+21
-18
lines changed

JsonToKotlinClass.iml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
99
<sourceFolder url="file://$MODULE_DIR$/resources" type="java-resource" />
1010
</content>
11-
<orderEntry type="inheritedJdk" />
11+
<orderEntry type="jdk" jdkName="IntelliJ IDEA IU-171.4694.70" jdkType="IDEA JDK" />
1212
<orderEntry type="sourceFolder" forTests="false" />
1313
</component>
1414
</module>

src/wu/seal/jsontokotlin/supporter/CustomJsonLibSupporter.kt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package wu.seal.jsontokotlin.supporter
22

3+
import wu.seal.jsontokotlin.ConfigManager
34
import wu.seal.jsontokotlin.codeelements.KPropertyKeyword
45
import wu.seal.jsontokotlin.codeelements.KPropertyName
56
import wu.seal.jsontokotlin.codeelements.getDefaultValue
@@ -11,17 +12,18 @@ import wu.seal.jsontokotlin.codeelements.getDefaultValue
1112

1213
object CustomJsonLibSupporter : IJsonLibSupporter {
1314

14-
private val propertyAnnotation = wu.seal.jsontokotlin.ConfigManager.customAnnotaionFormatString
15+
private val propertyAnnotation
16+
get() = ConfigManager.customAnnotaionFormatString
1517

1618

1719
override val annotationImportClassString: String
18-
get() = wu.seal.jsontokotlin.ConfigManager.customAnnotaionImportClassString
20+
get() = ConfigManager.customAnnotaionImportClassString
1921

2022
override fun getJsonLibSupportPropertyBlockString(rawPropertyName: String, propertyType: String): String {
2123

2224
val customJsonLibSupportPropertyBuilder = StringBuilder()
2325

24-
customJsonLibSupportPropertyBuilder.append(wu.seal.jsontokotlin.supporter.CustomJsonLibSupporter.propertyAnnotation.format(rawPropertyName))
26+
customJsonLibSupportPropertyBuilder.append(CustomJsonLibSupporter.propertyAnnotation.format(rawPropertyName))
2527

2628
customJsonLibSupportPropertyBuilder.append(" ")
2729

@@ -35,7 +37,7 @@ object CustomJsonLibSupporter : IJsonLibSupporter {
3537

3638
customJsonLibSupportPropertyBuilder.append(propertyType)
3739

38-
if (wu.seal.jsontokotlin.ConfigManager.initWithDefaultValue) {
40+
if (ConfigManager.initWithDefaultValue) {
3941
customJsonLibSupportPropertyBuilder.append(" = ").append(getDefaultValue(propertyType))
4042
}
4143

src/wu/seal/jsontokotlin/supporter/FastjsonSupporter.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ object FastjsonSupporter : IJsonLibSupporter {
2222

2323
val fastjsonSupportPropertyBuilder = StringBuilder()
2424

25-
fastjsonSupportPropertyBuilder.append(wu.seal.jsontokotlin.supporter.FastjsonSupporter.propertyAnnotation.format(rawPropertyName))
25+
fastjsonSupportPropertyBuilder.append(FastjsonSupporter.propertyAnnotation.format(rawPropertyName))
2626

2727
fastjsonSupportPropertyBuilder.append(" ")
2828

src/wu/seal/jsontokotlin/supporter/GsonSupporter.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ interface IGsonSupporter {
2323

2424
fun main(args: Array<String>) {
2525
wu.seal.jsontokotlin.isTestModel = true
26-
println("getGsonSupporterProperty:\n ${wu.seal.jsontokotlin.supporter.GsonSupporter.getGsonSupporterProperty("seal is **() good_man ", "Boy")}")
26+
println("getGsonSupporterProperty:\n ${GsonSupporter.getGsonSupporterProperty("seal is **() good_man ", "Boy")}")
2727
}
2828

29-
object GsonSupporter : wu.seal.jsontokotlin.supporter.IGsonSupporter {
29+
object GsonSupporter : IGsonSupporter {
3030

3131
/**
3232
* When adapter Gson lib at most ,We should import the Anotation Class
@@ -39,7 +39,7 @@ object GsonSupporter : wu.seal.jsontokotlin.supporter.IGsonSupporter {
3939

4040
val gsonSupportPropertyBuilder = StringBuilder()
4141

42-
gsonSupportPropertyBuilder.append(wu.seal.jsontokotlin.supporter.GsonSupporter.anotaionOnProperty.format(rawPropertyName))
42+
gsonSupportPropertyBuilder.append(GsonSupporter.anotaionOnProperty.format(rawPropertyName))
4343

4444
gsonSupportPropertyBuilder.append(" ")
4545

src/wu/seal/jsontokotlin/supporter/JacksonSupporter.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,18 @@ interface IJacksonSupporter {
2222

2323
fun main(args: Array<String>) {
2424
wu.seal.jsontokotlin.isTestModel = true
25-
println("getGsonSupporterProperty:\n ${wu.seal.jsontokotlin.supporter.JacksonSupporter.getJacksonSupporterProperty("seal is **() good_man ", "Boy")}")
25+
println("getGsonSupporterProperty:\n ${JacksonSupporter.getJacksonSupporterProperty("seal is **() good_man ", "Boy")}")
2626
}
2727

28-
object JacksonSupporter : wu.seal.jsontokotlin.supporter.IJacksonSupporter {
28+
object JacksonSupporter : IJacksonSupporter {
2929

3030
private val anotaionOnProperty = "@JsonProperty(\"%s\")"
3131

3232
override fun getJacksonSupporterProperty(rawPropertyName: String, propertyType: String): String {
3333

3434
val jacksonSupportPropertyBuilder = StringBuilder()
3535

36-
jacksonSupportPropertyBuilder.append(wu.seal.jsontokotlin.supporter.JacksonSupporter.anotaionOnProperty.format(rawPropertyName))
36+
jacksonSupportPropertyBuilder.append(JacksonSupporter.anotaionOnProperty.format(rawPropertyName))
3737

3838
jacksonSupportPropertyBuilder.append(" ")
3939

src/wu/seal/jsontokotlin/supporter/LoganSquareSupporter.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ object LoganSquareSupporter : IJsonLibSupporter {
2222

2323
val loganSquareSupportPropertyBuilder = StringBuilder()
2424

25-
loganSquareSupportPropertyBuilder.append(wu.seal.jsontokotlin.supporter.LoganSquareSupporter.propertyAnnotation.format(rawPropertyName))
25+
loganSquareSupportPropertyBuilder.append(LoganSquareSupporter.propertyAnnotation.format(rawPropertyName))
2626

2727
loganSquareSupportPropertyBuilder.append(" ")
2828

src/wu/seal/jsontokotlin/supporter/MoShiSupporter.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ object MoShiSupporter : IJsonLibSupporter {
2020
override fun getJsonLibSupportPropertyBlockString(rawPropertyName: String, propertyType: String): String {
2121
val moShijsonSupportPropertyBuilder = StringBuilder()
2222

23-
moShijsonSupportPropertyBuilder.append(wu.seal.jsontokotlin.supporter.MoShiSupporter.propertyAnnotation.format(rawPropertyName))
23+
moShijsonSupportPropertyBuilder.append(MoShiSupporter.propertyAnnotation.format(rawPropertyName))
2424

2525
moShijsonSupportPropertyBuilder.append(" ")
2626

src/wu/seal/jsontokotlin/ui/JsonInputDialog.kt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package wu.seal.jsontokotlin.ui
22

33
import com.intellij.openapi.project.Project
4+
import com.intellij.openapi.ui.InputValidator
45
import com.intellij.openapi.ui.Messages
56
import com.intellij.ui.DocumentAdapter
67
import com.intellij.ui.components.JBLabel
@@ -17,7 +18,7 @@ import javax.swing.event.DocumentEvent
1718
*/
1819

1920

20-
class MyInputValidator : com.intellij.openapi.ui.InputValidator {
21+
class MyInputValidator : InputValidator {
2122

2223
lateinit var classNameField: JTextField
2324
override fun checkInput(inputString: String): Boolean {
@@ -42,7 +43,7 @@ val myInputValidator = MyInputValidator()
4243
/**
4344
* Json input Dialog
4445
*/
45-
class JsonInputDialog(project: Project) : Messages.InputDialog(project, "Please input the class name and JSON data for generating Kotlin data class", "Make Kotlin Data Class", Messages.getInformationIcon(), "", myInputValidator) {
46+
class JsonInputDialog(project: Project) : Messages.InputDialog(project, "Please input the class name and JSON text for generating Kotlin data class", "Make Kotlin Data Class", Messages.getInformationIcon(), "", myInputValidator) {
4647

4748
private lateinit var classNameInput: JTextField
4849

@@ -76,7 +77,7 @@ class JsonInputDialog(project: Project) : Messages.InputDialog(project, "Please
7677
classNameInputContainer.preferredSize = JBDimension(500, 50)
7778

7879

79-
val createScrollableTextComponent = createScrollableTextComponent()
80+
val createScrollableTextComponent = createMyScrollableTextComponent()
8081
val jsonInputContainer = createLinearLayoutVertical()
8182
val jsonTitle = JBLabel("JSON Text:")
8283
jsonTitle.border = JBEmptyBorder(5, 0, 5, 0)
@@ -117,7 +118,7 @@ class JsonInputDialog(project: Project) : Messages.InputDialog(project, "Please
117118
}
118119

119120

120-
protected override fun createScrollableTextComponent(): javax.swing.JComponent {
121+
protected fun createMyScrollableTextComponent(): javax.swing.JComponent {
121122
return com.intellij.ui.components.JBScrollPane(myField)
122123
}
123124

0 commit comments

Comments
 (0)