2022년 10월 10일 월요일

Android + Kotlin + Aspectj

Android + Kotlin + Aspectj

Android + Kotlin + Aspectj

https://github.com/Ibotta/gradle-aspectj-pipeline-plugin/blob/develop/sample-kotlin/src/main/kotlin/com/ibotta/gradle/aop/kotlin/KotlinAspect.kt

https://yunhos.blogspot.com/2020/03/kotlin-aop.html

여기를 참고해서 설정하고.

@Aspect  
class KotlinAspect {  
    @Before("execution(* com.sugoigroup.mytvapplication*..*(..))")  
    fun before(joinPoint: JoinPoint) {  
        val methodSignature = joinPoint!!.signature as MethodSignature  
        val methodName = methodSignature.name  
  val startTime = System.currentTimeMillis();  
        val result = (joinPoint as ProceedingJoinPoint).proceed()  
        val endTime = System.currentTimeMillis() - startTime  
        Log.e("LoggingVM", "$methodName ---> $endTime")  
    }  
  
    @After("execution(* demonstrateKotlinAOP(..))")  
    fun after(joinPoint: JoinPoint) {  
  
    }  
}

0 comments:

댓글 쓰기