com.fasterxml.jackson.module.kotlin.ConstructorValueCreator.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jackson-module-kotlin Show documentation
Show all versions of jackson-module-kotlin Show documentation
Add-on module for Jackson (https://github.com/FasterXML/jackson/) to support
Kotlin language, specifically introspection of method/constructor parameter names,
without having to add explicit property name annotation.
package com.fasterxml.jackson.module.kotlin
import kotlin.reflect.KFunction
import kotlin.reflect.jvm.isAccessible
internal class ConstructorValueCreator(override val callable: KFunction) : ValueCreator() {
override val accessible: Boolean = callable.isAccessible
override val bucketGenerator: BucketGenerator = BucketGenerator.forConstructor(callable.parameters.size)
init {
// To prevent the call from failing, save the initial value and then rewrite the flag.
if (!accessible) callable.isAccessible = true
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy