interface KType : KAnnotatedElement
interface KType
Represents a type. Type is usually either a class with optional type arguments, or a type parameter of some declaration, plus nullability.
Type arguments passed for the parameters of the classifier in this type. For example, in the type Array<out Number>
the only type argument is out Number
.
abstract val arguments: List<KTypeProjection>
true
if this type was marked nullable in the source code.
abstract val isMarkedNullable: Boolean
Returns a Java Type instance corresponding to the given Kotlin type. Note that one Kotlin type may correspond to different JVM types depending on where it appears. For example, Unit corresponds to the JVM class Unit when it's the type of a parameter, or to void
when it's the return type of a function.
val KType.javaType: Type
Returns the KClass instance representing the runtime class to which this type is erased to on JVM.
val KType.jvmErasure: KClass<*>
Returns an annotation of the given type on this element.
fun <T : Annotation> KAnnotatedElement.findAnnotation(): T?
Returns true if this element is annotated with an annotation of type T.
fun <T : Annotation> KAnnotatedElement.hasAnnotation(): Boolean
Returns true
if this
type is the same or is a subtype of other, false
otherwise.
fun KType.isSubtypeOf(other: KType): Boolean
Returns true
if this
type is the same or is a supertype of other, false
otherwise.
fun KType.isSupertypeOf(other: KType): Boolean
Returns a new type with the same classifier, arguments and annotations as the given type, and with the given nullability.
fun KType.withNullability(nullable: Boolean): KType
© 2010–2019 JetBrains s.r.o.
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.reflect/-k-type/index.html