mirror of
https://github.com/HighCapable/Gropify.git
synced 2025-12-11 15:53:54 +08:00
fix: correct finalValue assignment logic in PropertyType for autoConversion
This commit is contained in:
@@ -145,8 +145,10 @@ internal fun Any.createTypeValueByType(autoConversion: Boolean, key: String): Pr
|
|||||||
.replace("\"", "\\\"")
|
.replace("\"", "\\\"")
|
||||||
|
|
||||||
val trimmed = valueString.trim()
|
val trimmed = valueString.trim()
|
||||||
|
|
||||||
|
if (!autoConversion) return PropertyTypeValue(this.toString(), "\"$valueString\"", String::class)
|
||||||
|
|
||||||
val finalValue = if (autoConversion) when (typeSpec) {
|
val finalValue = when (typeSpec) {
|
||||||
String::class, CharSequence::class -> "\"$trimmed\""
|
String::class, CharSequence::class -> "\"$trimmed\""
|
||||||
Char::class -> "'$trimmed'"
|
Char::class -> "'$trimmed'"
|
||||||
Boolean::class -> trimmed
|
Boolean::class -> trimmed
|
||||||
@@ -157,7 +159,7 @@ internal fun Any.createTypeValueByType(autoConversion: Boolean, key: String): Pr
|
|||||||
"Unsupported property \"$key\" value type: ${typeSpec.qualifiedName}, " +
|
"Unsupported property \"$key\" value type: ${typeSpec.qualifiedName}, " +
|
||||||
"only String, CharSequence, Char, Boolean, Int, Long, Float, Double are supported."
|
"only String, CharSequence, Char, Boolean, Int, Long, Float, Double are supported."
|
||||||
)
|
)
|
||||||
} else "\"$valueString\""
|
}
|
||||||
|
|
||||||
return PropertyTypeValue(this.toString(), finalValue, typeSpec)
|
return PropertyTypeValue(this.toString(), finalValue, typeSpec)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user