Around
Marks a function inside an Aspect-annotated class as around advice.
The annotated function replaces the target function's execution. The advice receives a ProceedingJoinPoint and can call ProceedingJoinPoint.proceed to invoke the original function body, optionally supplying different arguments. If ProceedingJoinPoint.proceed is never called, the original body is skipped entirely.
The advice function must declare exactly one parameter of type ProceedingJoinPoint.
Example
@Around(target = [Timed::class])
fun measureTime(joinPoint: ProceedingJoinPoint) {
val start = System.currentTimeMillis()
joinPoint.proceed()
println("Elapsed: ${System.currentTimeMillis() - start} ms")
}Content copied to clipboard