Slide 34
Slide 34 text
Proxy.newProxyInstanceͷྫ
interface Service {
fun doSomething(value: Int)
}
fun create(service: Class): T {
return Proxy.newProxyInstance(
service.classLoader,
Array(1) { service },
InvocationHandler { proxy, method, args ->
Log.d(TAG, "start")
Log.d(TAG, method.name +
if (args.isNotEmpty()) args[0] else "")
Log.d(TAG, "end")
}
) as T
}