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

kotlinx.reflect.lite.jvm.JvmClassMapping.kt Maven / Gradle / Ivy

Go to download

Experimental lightweight library that replaces existing 'kotlin-reflect' implementation

The newest version!
/*
 * Copyright 2016-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
 */

@file:JvmName("JvmClassMappingKt")

package kotlinx.reflect.lite.jvm

import kotlinx.reflect.lite.*
import kotlinx.reflect.lite.impl.*
import kotlinx.reflect.lite.impl.KClassImpl
import kotlinx.reflect.lite.impl.ReflectionLiteImpl

/**
 * Returns a [KClass] instance corresponding to the given Java [Class] instance.
 */
public val  Class.kotlin: KClass
    @JvmName("getLiteKClass")
    get() = ReflectionLiteImpl.getOrCreateKotlinClass(this)

/**
 * Returns a [KPackage] instance corresponding to the given Java [Class] instance.
 */
public val  Class.kotlinPackage: KPackage
    @JvmName("getLiteKPackage")
    get() = ReflectionLiteImpl.createKotlinPackage(this)

/**
 * Returns a Java [Class] instance corresponding to the given [KClass] instance.
 */
@Suppress("UNCHECKED_CAST")
public val  KClass.java: Class
    @JvmName("getJavaClass")
    get() = (this as KClassImpl).descriptor.jClass as Class




© 2015 - 2025 Weber Informatics LLC | Privacy Policy