injectBefore

fun injectBefore(targetClassName: String, methodName: String, parameterTypeNames: List<String> = emptyList(), owner: String? = null, handler: (UnsafeInvocationContext) -> Unit): UnsafeHandle

Injects a callback before target method execution (string-based overload).

Return

injection handle, usable by rollbackUnsafe

Parameters

targetClassName

target class fully-qualified name

methodName

target method name

parameterTypeNames

parameter type names, e.g. int, java.lang.String

owner

script owner (nullable, auto-resolved from script context if null)

handler

before callback


fun injectBefore(method: Method, owner: String? = null, handler: (UnsafeInvocationContext) -> Unit): UnsafeHandle

Injects a callback before target method execution (Method overload).

Prefer this overload when a reflected Method is already available, to avoid string-signature assembly errors.