MemberName

data class MemberName

Represents the name of a member (such as a function or a property).

Parameters

packageName

e.g. kotlin.collections

enclosingClassName

e.g. Map.Entry.Companion, if the member is declared inside the companion object of the Map.Entry class

simpleName

e.g. isBlank, size

isExtension

whether the member is an extension property or an extension function. Default is false.

If there is a member with the same name as this member in a local scope, the generated code will include this member's fully-qualified name to avoid ambiguity, e.g.:

package com.squareup.tacos

import kotlin.Unit

public class TacoTest {
public fun test(): Unit {
kotlin.error("errorText")
}

public fun error(): Unit {
}
}

However, since Kotlin compiler does not allow fully-qualified extension members, if isExtension is set to true for this MemberName, the generated code will include an import for this member and its simple name at the call site, e.g.:

package com.squareup.tacos

import kotlin.Unit
import kotlin.hashCode

public class TacoTest {
public override fun hashCode(): Unit {
var result = super.hashCode
if (result == 0) {
result = result * 37 + embedded_message.hashCode()
super.hashCode = result
}
return result
}
}

Constructors

MemberName
Link copied to clipboard
fun MemberName(packageName: String, simpleName: String)
MemberName
Link copied to clipboard
fun MemberName(packageName: String, simpleName: String, isExtension: Boolean)
MemberName
Link copied to clipboard
fun MemberName(enclosingClassName: ClassName, simpleName: String)
MemberName
Link copied to clipboard
fun MemberName(enclosingClassName: ClassName, simpleName: String, isExtension: Boolean)
MemberName
Link copied to clipboard
fun MemberName(packageName: String, operator: KOperator)
MemberName
Link copied to clipboard
fun MemberName(enclosingClassName: ClassName, operator: KOperator)

Types

Companion
Link copied to clipboard
object Companion

Functions

reference
Link copied to clipboard
fun reference(): CodeBlock
Callable reference to this member.
toString
Link copied to clipboard
open override fun toString(): String

Properties

canonicalName
Link copied to clipboard
val canonicalName: String
Fully qualified name using . as a separator, like kotlin.String.isBlank.
enclosingClassName
Link copied to clipboard
val enclosingClassName: ClassName?
e.g.
isExtension
Link copied to clipboard
val isExtension: Boolean = false
whether the member is an extension property or an extension function.
operator
Link copied to clipboard
val operator: KOperator? = null
packageName
Link copied to clipboard
val packageName: String
e.g.
simpleName
Link copied to clipboard
val simpleName: String
e.g.