ProceedingJoinPoint

Extends JoinPoint with the ability to proceed to the intercepted function's body.

A ProceedingJoinPoint is passed to Around-annotated advice functions. The advice controls whether and how the original function body executes by calling proceed.

Usage

@Around(target = [Timed::class])
fun measureTime(jp: ProceedingJoinPoint) {
val start = System.currentTimeMillis()
jp.proceed()
println("Elapsed: ${System.currentTimeMillis() - start} ms")
}

See also

DefaultProceedingJoinPoint

Types

Link copied to clipboard
fun interface OnProceedListener

SAM interface used by the AspectK compiler plugin to bridge the wrapper lambda generated at each intercepted call site with proceed.

Properties

Link copied to clipboard
abstract val args: List<Any?>

The runtime arguments passed to the intercepted function, in declaration order.

Link copied to clipboard

Compile-time metadata describing the intercepted function, including its name, annotations, and parameter list.

Link copied to clipboard
abstract val target: Any?

The receiver object on which the intercepted function is called, or null for top-level functions and functions called on companion objects.

Functions

Link copied to clipboard

Returns the AnnotationInfo for annotation T present on the intercepted function, or null if no such annotation is present.

Link copied to clipboard
inline fun <T> JoinPoint.getArg(name: String): T

Returns the argument value for the parameter named name, cast to T.

Link copied to clipboard
inline fun <T> JoinPoint.getArgOrNull(name: String): T?

Returns the argument value for the parameter named name, cast to T, or null if no such parameter exists or the value cannot be cast to T.

Link copied to clipboard
inline fun <T> JoinPoint.getTarget(): T

Returns JoinPoint.target cast to T.

Link copied to clipboard
inline fun <T> JoinPoint.getTargetOrNull(): T?

Returns JoinPoint.target cast to T, or null if the target is null or cannot be cast to T.

Link copied to clipboard
abstract fun proceed(): Any?

Proceeds to the intercepted function body with the original arguments.

abstract fun proceed(vararg args: Any?): Any?

Proceeds to the intercepted function body with substituted arguments.