-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
110 additions
and
174 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 18 additions & 27 deletions
45
kirc-image/src/main/resources/META-INF/native-image/reflect-conf.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,71 +1,62 @@ | ||
[ | ||
{ | ||
"name": "de.cmdjulian.kirc.image.Digest", | ||
"allDeclaredFields": true, | ||
"queryAllDeclaredMethods": true, | ||
"queryAllDeclaredConstructors": true, | ||
"methods": [ | ||
{ | ||
"name": "box-impl", | ||
"name": "<init>", | ||
"parameterTypes": [ | ||
"java.lang.String" | ||
] | ||
}, | ||
{ | ||
"name": "constructor-impl", | ||
"parameterTypes": [ | ||
"java.lang.String" | ||
] | ||
}, | ||
{ | ||
"name": "unbox-impl", | ||
"name": "getSeparator", | ||
"parameterTypes": [] | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "de.cmdjulian.kirc.image.Digest$Companion" | ||
}, | ||
{ | ||
"name": "de.cmdjulian.kirc.image.Repository", | ||
"allDeclaredFields": true, | ||
"queryAllDeclaredMethods": true, | ||
"queryAllDeclaredConstructors": true, | ||
"methods": [ | ||
{ | ||
"name": "box-impl", | ||
"parameterTypes": [ | ||
"java.lang.String" | ||
] | ||
}, | ||
{ | ||
"name": "constructor-impl", | ||
"name": "<init>", | ||
"parameterTypes": [ | ||
"java.lang.String" | ||
] | ||
}, | ||
{ | ||
"name": "unbox-impl", | ||
"parameterTypes": [] | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "de.cmdjulian.kirc.image.Tag", | ||
"allDeclaredFields": true, | ||
"queryAllDeclaredMethods": true, | ||
"queryAllDeclaredConstructors": true, | ||
"methods": [ | ||
{ | ||
"name": "box-impl", | ||
"parameterTypes": [ | ||
"java.lang.String" | ||
] | ||
}, | ||
{ | ||
"name": "constructor-impl", | ||
"name": "<init>", | ||
"parameterTypes": [ | ||
"java.lang.String" | ||
] | ||
}, | ||
{ | ||
"name": "unbox-impl", | ||
"name": "getSeparator", | ||
"parameterTypes": [] | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "de.cmdjulian.kirc.image.Tag$Companion" | ||
}, | ||
{ | ||
"name": "de.cmdjulian.kirc.image.Reference", | ||
"queryAllDeclaredMethods": true | ||
} | ||
] |
23 changes: 20 additions & 3 deletions
23
kirc-suspending/src/main/kotlin/de/cmdjulian/kirc/impl/JacksonDeserializer.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,25 @@ | ||
package de.cmdjulian.kirc.impl | ||
|
||
import com.fasterxml.jackson.module.kotlin.readValue | ||
import com.github.kittinunf.fuel.core.ResponseDeserializable | ||
import mu.KotlinLogging | ||
|
||
internal inline fun <reified T : Any> jacksonDeserializer() = object : ResponseDeserializable<T> { | ||
override fun deserialize(content: String): T = JsonMapper.readValue(content) | ||
class JacksonDeserializer<T : Any>(private val clazz: Class<T>) : ResponseDeserializable<T> { | ||
|
||
private val logger = KotlinLogging.logger { } | ||
|
||
override fun deserialize(content: String): T = try { | ||
JsonMapper.readValue(content, clazz) | ||
} catch (e: Exception) { | ||
logger.error(e) { "unexpected error on json deserialization" } | ||
throw e | ||
} | ||
|
||
override fun deserialize(bytes: ByteArray): T = try { | ||
JsonMapper.readValue(bytes, clazz) | ||
} catch (e: Exception) { | ||
logger.error(e) { "unexpected error on json deserialization" } | ||
throw e | ||
} | ||
} | ||
|
||
internal inline fun <reified T : Any> jacksonDeserializer() = JacksonDeserializer(T::class.java) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.