Package kotlin.reflect

Runtime API for /docs/reference/reflection.html

Runtime API for /docs/reference/reflection.html

Runtime API for /docs/reference/reflection.html

Runtime API for /docs/reference/reflection.html

Types

AssociatedObjectKey
Link copied to clipboard
annotation class AssociatedObjectKey

Makes the annotated annotation class an associated object key.

annotation class AssociatedObjectKey

Makes the annotated annotation class an associated object key.

ExperimentalAssociatedObjects
Link copied to clipboard
annotation class ExperimentalAssociatedObjects

The experimental marker for associated objects API.

annotation class ExperimentalAssociatedObjects

The experimental marker for associated objects API.

KAnnotatedElement
Link copied to clipboard
interface KAnnotatedElement

Represents an annotated element and allows to obtain its annotations. See the Kotlin language documentation for more information.

interface KAnnotatedElement

Represents an annotated element and allows to obtain its annotations. See the Kotlin language documentation for more information.

KCallable
Link copied to clipboard
expect interface KCallable<out R>

Represents a callable entity, such as a function or a property.

actual interface KCallable<out R> : KAnnotatedElement

Represents a callable entity, such as a function or a property.

actual interface KCallable<out R>

Represents a callable entity, such as a function or a property.

actual interface KCallable<out R> : KAnnotatedElement

Represents a callable entity, such as a function or a property.

KClass
Link copied to clipboard
expect interface KClass<T : Any> : KClassifier

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.

actual interface KClass<T : Any> : KDeclarationContainer, KAnnotatedElement, KClassifier

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.

actual interface KClass<T : Any> : KClassifier

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.

actual interface KClass<T : Any> : KDeclarationContainer, KAnnotatedElement, KClassifier

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.

KClassifier
Link copied to clipboard
interface KClassifier

A classifier is either a class or a type parameter.

Since Kotlin

1.1
KDeclarationContainer
Link copied to clipboard
interface KDeclarationContainer

Represents an entity which may contain declarations of any other entities, such as a class or a package.

interface KDeclarationContainer

Represents an entity which may contain declarations of any other entities, such as a class or a package.

KFunction
Link copied to clipboard
expect interface KFunction<out R> : KCallable<R> , Function<R>

Represents a function with introspection capabilities.

actual interface KFunction<out R> : KCallable<R> , Function<R>

Represents a function with introspection capabilities.

actual interface KFunction<out R> : KCallable<R> , Function<R>

Represents a function with introspection capabilities.

actual interface KFunction<out R> : KCallable<R> , Function<R>
KMutableProperty
Link copied to clipboard
expect interface KMutableProperty<V> : KProperty<V>

Represents a property declared as a var.

actual interface KMutableProperty<V> : KProperty<V>

Represents a property declared as a var.

actual interface KMutableProperty<V> : KProperty<V>

Represents a property declared as a var.

actual interface KMutableProperty<V> : KProperty<V>

Represents a property declared as a var.

KMutableProperty0
Link copied to clipboard
expect interface KMutableProperty0<V> : KProperty0<V> , KMutableProperty<V>

Represents a var-property without any kind of receiver.

actual interface KMutableProperty0<V> : KProperty0<V> , KMutableProperty<V>

Represents a var-property without any kind of receiver.

actual interface KMutableProperty0<V> : KProperty0<V> , KMutableProperty<V>

Represents a var-property without any kind of receiver.

actual interface KMutableProperty0<V> : KProperty0<V> , KMutableProperty<V>
KMutableProperty1
Link copied to clipboard
expect interface KMutableProperty1<T, V> : KProperty1<T, V> , KMutableProperty<V>

Represents a var-property, operations on which take one receiver as a parameter.

actual interface KMutableProperty1<T, V> : KProperty1<T, V> , KMutableProperty<V>

Represents a var-property, operations on which take one receiver as a parameter.

actual interface KMutableProperty1<T, V> : KProperty1<T, V> , KMutableProperty<V>

Represents a var-property, operations on which take one receiver as a parameter.

actual interface KMutableProperty1<T, V> : KProperty1<T, V> , KMutableProperty<V>
KMutableProperty2
Link copied to clipboard
expect interface KMutableProperty2<D, E, V> : KProperty2<D, E, V> , KMutableProperty<V>

Represents a var-property, operations on which take two receivers as parameters.

actual interface KMutableProperty2<D, E, V> : KProperty2<D, E, V> , KMutableProperty<V>

Represents a var-property, operations on which take two receivers as parameters.

actual interface KMutableProperty2<D, E, V> : KProperty2<D, E, V> , KMutableProperty<V>

Represents a var-property, operations on which take two receivers as parameters.

actual interface KMutableProperty2<D, E, V> : KProperty2<D, E, V> , KMutableProperty<V>
KParameter
Link copied to clipboard
interface KParameter : KAnnotatedElement

Represents a parameter passed to a function or a property getter/setter, including this and extension receiver parameters.

KProperty
Link copied to clipboard
expect interface KProperty<out V> : KCallable<V>

Represents a property, such as a named val or var declaration. Instances of this class are obtainable by the :: operator.

actual interface KProperty<out V> : KCallable<V>

Represents a property, such as a named val or var declaration. Instances of this class are obtainable by the :: operator.

actual interface KProperty<out V> : KCallable<V>

Represents a property, such as a named val or var declaration. Instances of this class are obtainable by the :: operator.

actual interface KProperty<out V> : KCallable<V>

Represents a property, such as a named val or var declaration. Instances of this class are obtainable by the :: operator.

KProperty0
Link copied to clipboard
expect interface KProperty0<out V> : KProperty<V> , Function0<V>

Represents a property without any kind of receiver. Such property is either originally declared in a receiverless context such as a package, or has the receiver bound to it.

actual interface KProperty0<out V> : KProperty<V> , Function0<V>

Represents a property without any kind of receiver. Such property is either originally declared in a receiverless context such as a package, or has the receiver bound to it.

actual interface KProperty0<out V> : KProperty<V> , Function0<V>

Represents a property without any kind of receiver. Such property is either originally declared in a receiverless context such as a package, or has the receiver bound to it.

actual interface KProperty0<out V> : KProperty<V> , Function0<V>
KProperty1
Link copied to clipboard
expect interface KProperty1<T, out V> : KProperty<V> , Function1<T, V>

Represents a property, operations on which take one receiver as a parameter.

actual interface KProperty1<T, out V> : KProperty<V> , Function1<T, V>

Represents a property, operations on which take one receiver as a parameter.

actual interface KProperty1<T, out V> : KProperty<V> , Function1<T, V>

Represents a property, operations on which take one receiver as a parameter.

actual interface KProperty1<T, out V> : KProperty<V> , Function1<T, V>
KProperty2
Link copied to clipboard
expect interface KProperty2<D, E, out V> : KProperty<V> , Function2<D, E, V>

Represents a property, operations on which take two receivers as parameters, such as an extension property declared in a class.

actual interface KProperty2<D, E, out V> : KProperty<V> , Function2<D, E, V>

Represents a property, operations on which take two receivers as parameters, such as an extension property declared in a class.

actual interface KProperty2<D, E, out V> : KProperty<V> , Function2<D, E, V>

Represents a property, operations on which take two receivers as parameters, such as an extension property declared in a class.

actual interface KProperty2<D, E, out V> : KProperty<V> , Function2<D, E, V>
KType
Link copied to clipboard
expect interface KType

Represents a type. Type is usually either a class with optional type arguments, or a type parameter of some declaration, plus nullability.

actual interface KType : KAnnotatedElement

Represents a type. Type is usually either a class with optional type arguments, or a type parameter of some declaration, plus nullability.

actual interface KType

Represents a type. Type is usually either a class with optional type arguments, or a type parameter of some declaration, plus nullability.

actual interface KType

Represents a type. Type is usually either a class with optional type arguments, or a type parameter of some declaration, plus nullability.

KTypeParameter
Link copied to clipboard
interface KTypeParameter : KClassifier

Represents a declaration of a type parameter of a class or a callable. See the Kotlin language documentation for more information.

Since Kotlin

1.1
KTypeProjection
Link copied to clipboard
data class KTypeProjection(variance: KVariance?, type: KType?)

Represents a type projection. Type projection is usually the argument to another type in a type usage. For example, in the type Array<out Number>, out Number is the covariant projection of the type represented by the class Number.

Since Kotlin

1.1
KVariance
Link copied to clipboard
enum KVariance : Enum<KVariance>

Represents variance applied to a type parameter on the declaration site (declaration-site variance), or to a type in a projection (use-site variance).

Since Kotlin

1.1
KVisibility
Link copied to clipboard
enum KVisibility : Enum<KVisibility>

Visibility is an aspect of a Kotlin declaration regulating where that declaration is accessible in the source code. Visibility can be changed with one of the following modifiers: public, protected, internal, private.

Since Kotlin

1.1

Functions

cast
Link copied to clipboard
fun <T : Any> KClass<T>.cast(value: Any?): T

Casts the given value to the class represented by this KClass object. Throws an exception if the value is null or if it is not an instance of this class.

Since Kotlin

1.4
findAssociatedObject
Link copied to clipboard
inline fun <T : Annotation> KClass<*>.findAssociatedObject(): Any?

If T is an @AssociatedObjectKey-annotated annotation class and this class is annotated with @T (S::class), returns object S.

inline fun <T : Annotation> KClass<*>.findAssociatedObject(): Any?

If T is an @AssociatedObjectKey-annotated annotation class and this class is annotated with @T (S::class), returns object S.

safeCast
Link copied to clipboard
fun <T : Any> KClass<T>.safeCast(value: Any?): T?

Casts the given value to the class represented by this KClass object. Returns null if the value is null or if it is not an instance of this class.

Since Kotlin

1.4
typeOf
Link copied to clipboard
inline fun <T> typeOf(): KType

Returns a runtime representation of the given reified type T as an instance of KType.

Since Kotlin

1.3

Properties

javaType
Link copied to clipboard
@ExperimentalStdlibApi
val KType.javaType: Type

Returns a Java Type instance corresponding to the given Kotlin type.