KParameter

interface KParameter : KAnnotatedElement

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

Types

Kind
Link copied to clipboard
enum Kind : Enum<KParameter.Kind>

Kind represents a particular position of the parameter declaration in the source code, such as an instance, an extension receiver parameter or a value parameter.

Properties

annotations
Link copied to clipboard
abstract val annotations: List<Annotation>

Annotations which are present on this element.

index
Link copied to clipboard
abstract val index: Int

0-based index of this parameter in the parameter list of its containing callable.

isOptional
Link copied to clipboard
abstract val isOptional: Boolean

true if this parameter is optional and can be omitted when making a call via KCallable.callBy, or false otherwise.

isVararg
Link copied to clipboard
abstract val isVararg: Boolean

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

kind
Link copied to clipboard
abstract val kind: KParameter.Kind

Kind of this parameter.

name
Link copied to clipboard
abstract val name: String?

Name of this parameter as it was declared in the source code, or null if the parameter has no name or its name is not available at runtime. Examples of nameless parameters include this instance for member functions, extension receiver for extension functions or properties, parameters of Java methods compiled without the debug information, and others.

type
Link copied to clipboard
abstract val type: KType

Type of this parameter. For a vararg parameter, this is the type of the corresponding array, not the individual element.