KClassifier

interface KClassifier (source)

Platform and version requirements: Kotlin 1.1

A classifier is either a class or a type parameter.

See Also

KClass

KTypeParameter

Inherited Functions

equals

open operator fun equals(other: Any?): Boolean

Indicates whether some other object is "equal to" this one. Implementations must fulfil the following requirements:

hashCode

open fun hashCode(): Int

Returns a hash code value for the object. The general contract of hashCode is:

toString

open fun toString(): String

Returns a string representation of the object.

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.

Inheritors

KClass

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.

KTypeParameter

interface KTypeParameter : KClassifier

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