12 lines
392 B
Kotlin
12 lines
392 B
Kotlin
package drills.drill02.exercise3
|
|
|
|
import java.lang.reflect.InvocationHandler
|
|
import java.lang.reflect.Method
|
|
|
|
class LogHandler(private val target: Any) : InvocationHandler {
|
|
override fun invoke(proxy: Any?, method: Method?, args: Array<out Any>?): Any {
|
|
println("log: method '$method' has been invoked")
|
|
return method?.invoke(target, *(args ?: arrayOf())) ?: Unit
|
|
}
|
|
}
|