KAnnotatedElement

JVM
Native
1.0
interface KAnnotatedElement
(JVM source) (Native source)

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

Properties

JVM
1.0

annotations

Annotations which are present on this element.

abstract val annotations: List<Annotation>

Extension Functions

JVM
1.1

findAnnotation

Returns an annotation of the given type on this element.

fun <T : Annotation> KAnnotatedElement.findAnnotation(): T?
JVM
1.7

findAnnotations

Returns all annotations of the given type on this element, including individually applied annotations as well as repeated annotations.

fun <T : Annotation> KAnnotatedElement.findAnnotations(): List<T>
fun <T : Annotation> KAnnotatedElement.findAnnotations(
    klass: KClass<T>
): List<T>
JVM
1.4

hasAnnotation

Returns true if this element is annotated with an annotation of type T.

fun <T : Annotation> KAnnotatedElement.hasAnnotation(): Boolean

Inheritors

KCallable

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

Common
JS
1.0
interface KCallable<out R>
JVM
Native
1.0
interface KCallable<out R> : KAnnotatedElement

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.

Common
JS
1.0
interface KClass<T : Any> : KClassifier
JVM
Native
1.0
interface KClass<T : Any> : 
    KDeclarationContainer,
    KAnnotatedElement,
    KClassifier
JVM
1.0

KParameter

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

interface KParameter : KAnnotatedElement

KType

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

Common
JS
Native
1.0
interface KType
JVM
1.0
interface KType : KAnnotatedElement