visit

fun <T : Any> KClass<T>.visit(visitor: ClassVisitor<T, *>)

Visits all metadata elements of a Kotlin class using the provided visitor. The visit follows a structured pattern: start, visit types, constructors, properties, functions, and end. This ensures consistent traversal order.

Parameters

T

the type of the class being visited

visitor

the visitor that will process each class element

Samples