All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.fasterxml.jackson.module.kotlin.ConstructorValueCreator.kt Maven / Gradle / Ivy

Go to download

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.

There is a newer version: 2.18.2
Show newest version
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