KClass

Represents a class and provides introspection capabilities. Instances of this class are obtainable by the ::class syntax. See the Kotlin language documentation for more information.

Since Kotlin

1.0

Parameters

T

the type of the class.

expect interface KClass<T : Any> : KClassifier(source)(source)

Represents a class and provides introspection capabilities. Instances of this class are obtainable by the ::class syntax. See the Kotlin language documentation for more information.

Since Kotlin

1.0

Parameters

T

the type of the class.

Properties

Link copied to clipboard
abstract val annotations: List<Annotation>

Annotations which are present on this element.

Since Kotlin 1.0
Link copied to clipboard

All constructors declared in this class.

Since Kotlin 1.0
Link copied to clipboard
@get:JvmName(name = "getJavaClass")
val <T> KClass<T>.java: Class<T>

Returns a Java Class instance corresponding to the given KClass instance.

Since Kotlin 1.0
Link copied to clipboard
@get:JvmName(name = "getRuntimeClassOfKClassInstance")
val <T : Any> KClass<T>.javaClass: Class<KClass<T>>
Since Kotlin 1.0
Link copied to clipboard

Returns a Java Class instance corresponding to the given KClass instance. In case of primitive types it returns corresponding wrapper classes.

Since Kotlin 1.0
Link copied to clipboard

Returns a Java Class instance representing the primitive type corresponding to the given KClass if it exists.

Since Kotlin 1.0
Link copied to clipboard
abstract override val members: Collection<KCallable<*>>

All functions and properties accessible in this class, including those declared in this class and all of its superclasses. Does not include constructors.

Since Kotlin 1.0
Link copied to clipboard
abstract val nestedClasses: Collection<KClass<*>>

All classes declared inside this class. This includes both inner and static nested classes.

Since Kotlin 1.0
Link copied to clipboard
abstract val objectInstance: T?

The instance of the object declaration, or null if this class is not an object declaration.

Since Kotlin 1.0
Link copied to clipboard
actual abstract val qualifiedName: String?
expect abstract val qualifiedName: String?

The fully qualified dot-separated name of the class, or null if the class is local or a class of an anonymous object.

Since Kotlin 1.0
Link copied to clipboard
actual abstract val simpleName: String?
expect abstract val simpleName: String?

The simple name of the class as it was declared in the source code, or null if the class has no name (if, for example, it is a class of an anonymous object).

Since Kotlin 1.0

Functions

Link copied to clipboard
abstract operator override fun equals(other: Any?): Boolean

Returns true if this KClass instance represents the same Kotlin class as the class represented by other. On JVM this means that all of the following conditions are satisfied:

Since Kotlin 1.0
Link copied to clipboard
abstract override fun hashCode(): Int
Since Kotlin 1.0