Package-level declarations
Extensions for /docs/reference/reflection.html provided by kotlin-reflect
library.
Types
An exception that is thrown when call
is invoked on a callable or get
or set
is invoked on a property and that callable is not accessible (in JVM terms) from the calling method.
An exception that is thrown when getDelegate
is invoked on a KProperty object that was not made accessible with isAccessible.
An exception that is thrown when the code tries to introspect a property of a class or a package and that class or the package no longer has that property.
Functions
Calls a callable in the current suspend context. If the callable is not a suspend function, behaves as KCallable.call. Otherwise, calls the suspend function with current continuation.
Calls a callable in the current suspend context. If the callable is not a suspend function, behaves as KCallable.callBy. Otherwise, calls the suspend function with current continuation.
Creates a new instance of the class, calling a constructor which either has no parameters or all parameters of which are optional (see KParameter.isOptional). If there are no or many such constructors, an exception is thrown.
Creates a KType instance with the given classifier, type arguments, nullability and annotations. If the number of passed type arguments is not equal to the total number of type parameters of a classifier, an exception is thrown. If any of the arguments does not satisfy the bounds of the corresponding type parameter, an exception is thrown.
Returns an annotation of the given type on this element.
Returns the parameter of this callable with the given name, or null
if there's no such parameter.
Returns the instance of a delegated extension property, or null
if this property is not delegated. Throws an exception if this is not an extension property.
Returns the instance of a delegated member extension property, or null
if this property is not delegated. Throws an exception if this is not an extension property.
Returns true if this element is annotated with an annotation of type T.
Returns true
if this
class is the same or is a (possibly indirect) subclass of base, false
otherwise.
Returns true
if this
type is the same or is a subtype of other, false
otherwise.
Returns true
if this
class is the same or is a (possibly indirect) superclass of derived, false
otherwise.
Returns true
if this
type is the same or is a supertype of other, false
otherwise.
Returns a new type with the same classifier, arguments and annotations as the given type, and with the given nullability.
Properties
Returns a KClass instance representing the companion object of a given class, or null
if the class doesn't have a companion object.
Returns a type corresponding to the given class with type parameters of that class substituted as the corresponding arguments. For example, for class MyMap<K, V>
defaultType would return the type MyMap<K, V>
.
Returns the primary constructor of this class, or null
if this class has no primary constructor. See the Kotlin language documentation for more information.
Creates an instance of KType with the given classifier, substituting all its type parameters with star projections. The resulting type is not marked as nullable and does not have any annotations.