Suspend Proceeding Join Point
The suspend counterpart of ProceedingJoinPoint.
When an Around-annotated advice targets a suspend function, the advice must itself be declared suspend and accept a SuspendProceedingJoinPoint instead of a ProceedingJoinPoint, because proceed resumes the original suspending body and therefore has to suspend too.
Usage
@Around(target = [Timed::class])
suspend fun measureTime(jp: SuspendProceedingJoinPoint): Any? {
val start = currentTimeMillis()
val result = jp.proceed()
println("Elapsed: ${currentTimeMillis() - start} ms")
return result
}A non-suspending target still uses ProceedingJoinPoint; the AspectK compiler plugin picks the right join point type based on whether the intercepted function is suspend.
See also
Types
SAM interface used by the AspectK compiler plugin to bridge the wrapper lambda generated at each intercepted call site with proceed.
Properties
Functions
Returns the AnnotationInfo for annotation T present on the intercepted function, or null if no such annotation is present.
Returns the arguments of annotation T on the intercepted function, by parameter name.
Returns JoinPoint.target cast to T, or null if the target is null or cannot be cast to T.
Proceeds with the original arguments and returns the result cast to T.
Proceeds with substituted arguments, as SuspendProceedingJoinPoint.proceed does, and returns the result cast to T.
Proceeds with the arguments named in replacements replaced and every other one kept.