SimpleFunctionAccessor

data class SimpleFunctionAccessor<T, R>(val function: KFunction<*>) : FunctionAccessor<T, R>

Simple implementation of FunctionAccessor that provides basic function invocation capabilities. This class automatically ensures the function is accessible during initialization, making it ready for reflection-based invocation.

Author

ahoo wang

Parameters

T

the type of the target object

R

the return type of the function

Constructors

Link copied to clipboard
constructor(function: KFunction<*>)

Properties

Link copied to clipboard
open override val function: KFunction<*>

the Kotlin function to be accessed

Link copied to clipboard
open val method: Method

The underlying Java Method object for this function. This method is guaranteed to be non-null for accessible functions.

Link copied to clipboard
open override val name: String

The name of the function, inherited from the Named interface. Returns the simple name of the underlying Kotlin function.

Link copied to clipboard
open val targetType: Class<T>

The Java Class representing the type of the target object. This is derived from the declaring class of the function.

Functions

Link copied to clipboard
open fun invoke(target: T, args: Array<Any?>): R

Invokes the function on the specified target object with the given arguments. Uses FastInvoke.safeInvoke for proper exception handling and performance.