Skip to content

effectiveDeclarations

Returns the body declarations of this class or object in source order, followed by the class's primary-constructor val/var property parameters in parameter order.

Example:

Given accountClass representing:

class Account(val id: Int, name: String) {
    fun save() {}
}

accountClass.effectiveDeclarations().mapNotNull { it.name } returns listOf("save", "id"): id is included because it declares a property, while the ordinary constructor parameter name is not.