JoinPoint

interface JoinPoint(source)

Provides contextual information about an intercepted function call.

A JoinPoint instance is constructed by the AspectK compiler plugin at each intercepted call site and passed to every matching advice function. It exposes the receiver object, static method-signature metadata, and the runtime arguments of the call.

The concrete implementation injected at runtime is io.github.molelabs.aspectk.runtime.internal.DefaultJoinPoint. Advice code should program to this interface rather than the concrete type.

Usage in advice

@Before(target = [Authenticated::class])
fun checkAuth(joinPoint: JoinPoint) {
val receiver = joinPoint.target // null for top-level functions
val name = joinPoint.signature.methodName
val firstArg = joinPoint.args.firstOrNull()
// Type-safe argument access:
val userId = joinPoint.args[0] as? String
}

See also

DefaultJoinPoint

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.