From 2892f613972ccc5aec85a47696710f8ff4c59884 Mon Sep 17 00:00:00 2001 From: Ted Date: Wed, 21 Aug 2019 16:43:58 +0800 Subject: [PATCH] bug #227 is fixed --- src/main/kotlin/extensions/wu/seal/PropertyPrefixSupport.kt | 6 ++++-- src/main/kotlin/extensions/wu/seal/PropertySuffixSupport.kt | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/kotlin/extensions/wu/seal/PropertyPrefixSupport.kt b/src/main/kotlin/extensions/wu/seal/PropertyPrefixSupport.kt index 6efbb251..87336c35 100644 --- a/src/main/kotlin/extensions/wu/seal/PropertyPrefixSupport.kt +++ b/src/main/kotlin/extensions/wu/seal/PropertyPrefixSupport.kt @@ -33,8 +33,10 @@ object PropertyPrefixSupport : Extension() { val originProperties = kotlinDataClass.properties val newProperties = originProperties.map { val prefix = getConfig(prefixKey) - val newName = prefix + it.name.first().toUpperCase() + it.name.substring(1) - it.copy(name = newName) + if (it.name.isNotEmpty()) { + val newName = prefix + it.name.first().toUpperCase() + it.name.substring(1) + it.copy(name = newName) + } else it } kotlinDataClass.copy(properties = newProperties) } else { diff --git a/src/main/kotlin/extensions/wu/seal/PropertySuffixSupport.kt b/src/main/kotlin/extensions/wu/seal/PropertySuffixSupport.kt index 2eab5e52..39907501 100644 --- a/src/main/kotlin/extensions/wu/seal/PropertySuffixSupport.kt +++ b/src/main/kotlin/extensions/wu/seal/PropertySuffixSupport.kt @@ -32,8 +32,10 @@ object PropertySuffixSupport : Extension() { val originProperties = kotlinDataClass.properties val newProperties = originProperties.map { val suffix = getConfig(suffixKey) - val newName = it.name + suffix.first().toUpperCase() + suffix.substring(1) - it.copy(name = newName) + if (it.name.isNotEmpty()) { + val newName = it.name + suffix.first().toUpperCase() + suffix.substring(1) + it.copy(name = newName) + } else it } kotlinDataClass.copy(properties = newProperties) } else {