feat(json): 修复Jackson3JsonApi Jvm 签名
Gitea Actions Build / Build (push) Canceled after 0s

This commit is contained in:
2026-10-12 14:01:13 +08:00
parent 2c423c4aff
commit 6624c00553
@@ -16,7 +16,7 @@
* ProjectName mingli-utils * ProjectName mingli-utils
* ModuleName mingli-utils.main * ModuleName mingli-utils.main
* CurrentFile Jackson3JsonApi.kt * CurrentFile Jackson3JsonApi.kt
* LastUpdate 2026-10-12 13:57:11 * LastUpdate 2026-10-12 13:59:59
* UpdateUser MingLiPro * UpdateUser MingLiPro
*/ */
@@ -44,9 +44,9 @@ class Jackson3JsonApi : JsonApi {
private var _prObjectMapper: ObjectMapper? = null private var _prObjectMapper: ObjectMapper? = null
private var objectMapper: ObjectMapper var objectMapper: ObjectMapper
get() = get() get() = get()
set(value) = set(value) private set(value) = set(value)
constructor(objectMapper: ObjectMapper) { constructor(objectMapper: ObjectMapper) {
_prObjectMapper = objectMapper _prObjectMapper = objectMapper
@@ -64,9 +64,6 @@ class Jackson3JsonApi : JsonApi {
_prObjectMapper = ObjectMapper() _prObjectMapper = ObjectMapper()
} }
fun getObjectMapper() = _prObjectMapper
override fun <T> parse(json: String, clazz: Class<T>): T { override fun <T> parse(json: String, clazz: Class<T>): T {
try { try {
return objectMapper.readValue(json, clazz) return objectMapper.readValue(json, clazz)
@@ -181,8 +178,7 @@ class Jackson3JsonApi : JsonApi {
return objectMapper.convertValue(source, destinationClass) return objectMapper.convertValue(source, destinationClass)
} catch (e: Exception) { } catch (e: Exception) {
throw JsonException( throw JsonException(
"Failed to convert from ${source.javaClass.simpleName} to ${destinationClass.simpleName}", "Failed to convert from ${source.javaClass.simpleName} to ${destinationClass.simpleName}", e
e
) )
} }
} }