File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed
src/main/kotlin/wu/seal/jsontokotlin/utils/classblockparse Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ apply plugin: 'kotlin'
2020apply plugin : ' org.jetbrains.intellij'
2121
2222group ' wu.seal'
23- version ' 2.1.1 '
23+ version ' 2.1.2 '
2424
2525intellij {
2626 updateSinceUntilBuild false
Original file line number Diff line number Diff line change @@ -104,10 +104,11 @@ class ClassCodeParser(private val classBlockString: String) {
104104
105105 private fun getPropertyType (propertyLine : String , isLastLine : Boolean ): String {
106106 val deleteCommentPropertyLine = propertyLine.substringBefore(" //" )
107- if (deleteCommentPropertyLine.contains(" =" )) {
108- return deleteCommentPropertyLine.substringAfter(" :" ).split(" =" )[0 ].trim()
107+ val typeAndValueBlock = deleteCommentPropertyLine.substringAfterLast(" :" )
108+ if (typeAndValueBlock.contains(" =" )) {
109+ return typeAndValueBlock.split(" =" )[0 ].trim()
109110 } else {
110- val substringBefore = deleteCommentPropertyLine.substringAfter( " : " ).substringBefore( " // " )
111+ val substringBefore = typeAndValueBlock
111112 return if (isLastLine)
112113 substringBefore.trim()
113114 else
@@ -117,8 +118,9 @@ class ClassCodeParser(private val classBlockString: String) {
117118
118119 private fun getPropertyValue (propertyLine : String , isLastLine : Boolean ): String {
119120 val deleteCommentPropertyLine = propertyLine.substringBefore(" //" )
120- if (deleteCommentPropertyLine.contains(" =" )) {
121- val propertyValuePre = deleteCommentPropertyLine.substringAfter(" :" ).split(" =" )[1 ]
121+ val typeAndValueBlock = deleteCommentPropertyLine.substringAfterLast(" :" )
122+ if (typeAndValueBlock.contains(" =" )) {
123+ val propertyValuePre = typeAndValueBlock.split(" =" )[1 ]
122124 return if (isLastLine) {
123125 propertyValuePre.trim()
124126 } else {
You can’t perform that action at this time.
0 commit comments