Skip to content

Commit 51245c7

Browse files
authored
Merge pull request #254 from wuseal/3.5.1
Release V3.5.1
2 parents 990bcfe + fd8bc7d commit 51245c7

File tree

4 files changed

+18
-5
lines changed

4 files changed

+18
-5
lines changed

src/main/kotlin/wu/seal/jsontokotlin/classscodestruct/Property.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,9 @@ data class Property(
1111
val comment: String = "",
1212
var isLast: Boolean = false,
1313
val refTypeId: Int = -1, // the id of property type,if can't reference in current generate classes ,use the default value -1
14-
val typeObject: KotlinDataClass? = null//property type ref to the Kotlin Data Class Struct Object
14+
val typeObject: KotlinDataClass? = null,//property type ref to the Kotlin Data Class Struct Object
15+
private var separatorBetweenAnnotationAndProperty:String = "\n"
1516
) {
16-
17-
private var separatorBetweenAnnotationAndProperty = "\n"
18-
1917
fun letLastAnnotationStayInSameLine() {
2018
separatorBetweenAnnotationAndProperty = " "
2119
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class JsonInputDialog(classsName: String, private val project: Project) : Messag
6363
label("JSON Text: ", 14f)()
6464
label("Tips: you can use JSON string、http urls or local file just right click on text area", 12f)()
6565
fillSpace()
66-
button("JSON Format") {
66+
button("Format") {
6767
handleFormatJSONString()
6868
}()
6969
}()

src/main/resources/META-INF/plugin.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,11 @@
4848

4949
<change-notes><![CDATA[
5050
<br>Bugs fix </br>
51+
<br>1. fix option :Keep Annotation and property in single line</br>
5152
<br>New Features </br>
53+
<br>1. AndroidX @Keep Annotation support</br>
54+
<br>2. Support Init with default JSON value</br>
55+
<br>3. Make dot to be word separate character</br>
5256
<br>Note:</br>
5357
<a href="https://github.com/wuseal/JsonToKotlinClass/milestone/11"> detail update</a></br>
5458
]]>

src/test/kotlin/extensions/ted/zeng/PropertyAnnotationLineSupportTest.kt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package extensions.ted.zeng
33
import com.winterbe.expekt.should
44
import org.junit.Before
55
import org.junit.Test
6+
import wu.seal.jsontokotlin.KotlinCodeMaker
67
import wu.seal.jsontokotlin.generateKotlinDataClass
78
import wu.seal.jsontokotlin.interceptor.annotations.fastjson.AddFastJsonAnnotationInterceptor
89
import wu.seal.jsontokotlin.test.TestConfig
@@ -30,4 +31,14 @@ class PropertyAnnotationLineSupportTest {
3031
result.should.equal(expectResult)
3132
}
3233

34+
@Test
35+
fun finalClassCodeTest() {
36+
val expectResult = """data class Test(
37+
@SerializedName("a") val a: String = "", // a
38+
@SerializedName("Int") val int: Int = 0 // 2
39+
)"""
40+
PropertyAnnotationLineSupport.getTestHelper().setConfig("ted.zeng.property_annotation_in_same_line_enable", "true")
41+
val resultCode = KotlinCodeMaker("Test", json).makeKotlinData()
42+
resultCode.should.be.equal(expectResult)
43+
}
3344
}

0 commit comments

Comments
 (0)