kotlin.reflect.KTypeParameter

KTypeParameter

interface KTypeParameter : KClassifier

Platform and version requirements: Kotlin 1.1

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

Properties

isReified

abstract val isReified: Boolean

true if this type parameter is reified. See the Kotlin language documentation for more information.

name

abstract val name: String

The name of this type parameter as it was declared in the source code.

upperBounds

abstract val upperBounds: List<KType>

Upper bounds, or generic constraints imposed on this type parameter. See the Kotlin language documentation for more information.

variance

abstract val variance: KVariance

Declaration-site variance of this type parameter. See the Kotlin language documentation for more information.

Extension Properties

starProjectedType

val KClassifier.starProjectedType: KType

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.

Extension Functions

createType

fun KClassifier.createType(
    arguments: List<KTypeProjection> = emptyList(), 
    nullable: Boolean = false, 
    annotations: List<Annotation> = emptyList()
): KType

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.

© 2010–2017 JetBrains s.r.o.
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.reflect/-k-type-parameter/

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部