kotest-mpp / io.kotest.mpp / kotlin.reflect.KClass

Extensions for kotlin.reflect.KClass

annotation

Finds the first annotation of type T on this class, or returns null if annotations are not supported on this platform or the annotation is missing.

fun <T> KClass<*>.annotation(): T?

annotations

Returns the annotations on this class or empty list if not supported

fun KClass<*>.annotations(): List<Annotation>

bestName

Returns the longest possible name available for this class. That is, in order, the FQN, the simple name, or .

fun KClass<*>.bestName(): String

fqn

Returns the fully qualified name for this class, or null

fun KClass<*>.fqn(): String?

hasAnnotation

fun <T> KClass<*>.hasAnnotation(): Boolean

isDataClass

Returns true if this KClass is a data class, false if it is not, or null if the functionality is not supported on the platform.

val <T : Any> KClass<T>.isDataClass: Boolean?