File tree Expand file tree Collapse file tree 3 files changed +14
-18
lines changed
src/main/kotlin/wu/seal/jsontokotlin/interceptor Expand file tree Collapse file tree 3 files changed +14
-18
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.2-eap'
23+ version ' 2.2.0.1 -eap'
2424
2525intellij {
2626 version ' 2017.1'
Original file line number Diff line number Diff line change @@ -4,21 +4,22 @@ import wu.seal.jsontokotlin.ConfigManager
44
55object InterceptorManager {
66
7- fun getEnabledKotlinDataClassInterceptors () : List <IKotlinDataClassInterceptor >{
7+ fun getEnabledKotlinDataClassInterceptors (): List <IKotlinDataClassInterceptor > {
88
9- val interceptors = mutableListOf<IKotlinDataClassInterceptor >()
10- if (ConfigManager .enableMinimalAnnotation) {
11- interceptors.add(MinimalAnnotationKotlinDataClassInterceptor ())
12- }
9+ return mutableListOf<IKotlinDataClassInterceptor >().apply {
10+
11+ if (ConfigManager .enableMinimalAnnotation) {
12+ add(MinimalAnnotationKotlinDataClassInterceptor ())
13+ }
1314
14- if (ConfigManager .parenClassTemplate.isNotBlank()) {
15- interceptors.add(ParentClassTemplateKotlinDataClassInterceptor ())
15+ if (ConfigManager .parenClassTemplate.isNotBlank()) {
16+ add(ParentClassTemplateKotlinDataClassInterceptor ())
17+ }
1618 }
17- return interceptors
1819 }
1920
2021
21- fun getEnabledImportClassDeclarationInterceptors (): List <IImportClassDeclarationInterceptor >{
22+ fun getEnabledImportClassDeclarationInterceptors (): List <IImportClassDeclarationInterceptor > {
2223
2324 return mutableListOf<IImportClassDeclarationInterceptor >().apply {
2425
Original file line number Diff line number Diff line change @@ -4,6 +4,8 @@ import wu.seal.jsontokotlin.classscodestruct.KotlinDataClass
44
55/* *
66 * interceptor to make the code to be like the minimal annotation
7+ * which means that if the property name is the same as raw name then remove the
8+ * annotations contains %s
79 */
810class MinimalAnnotationKotlinDataClassInterceptor () : IKotlinDataClassInterceptor {
911
@@ -27,14 +29,7 @@ class MinimalAnnotationKotlinDataClassInterceptor() : IKotlinDataClassIntercepto
2729 }
2830 }
2931
30- return if (kotlinDataClass.nestedClasses.isNotEmpty()) {
31-
32- val newNestedClasses = kotlinDataClass.nestedClasses.map { intercept(it) }
33- kotlinDataClass.copy(properties = newProperties, nestedClasses = newNestedClasses)
34-
35- } else {
36- kotlinDataClass.copy(properties = newProperties)
37- }
32+ return kotlinDataClass.copy(properties = newProperties)
3833
3934 }
4035
You can’t perform that action at this time.
0 commit comments