div
open operator fun <Root, Parent, Child> KProperty1<Root, Parent>.div(child: KProperty1<Parent & Any, Child>): Field<Root, Child>(source)
Refers to child as a nested field of the current field.
Examples
class User(
val id: Int,
val profile: Profile,
)
class Profile(
val name: String,
val age: Int,
)
// Refer to the id
println(User::id)
// → 'id'
// Refer to the name
println(User::profile / Profile::name)
// → 'profile.name'
// Refer to the age
println(User::profile / Profile::age)
// → 'profile.age'
Content copied to clipboard
See also
Access a specific element of an array