Invocable
interface in package klyn.reflection

    public interface Invocable<ReturnType>:

Invocable

Common interface for all executable entities (functions, methods, constructors).

Enables uniform invocation and metadata access.

    import klyn.reflection

    # Function from eval
    f = eval("def fct(a as Int): return a * 2")
    if f is Invocable<Int>:
    result = f.invoke(21)

    # Method via reflection
    method = MyClass.class.getMethod("process")
    if method is Invocable<String>:
    result = method.invokeOn(instance, [])

Properties

Modifier and Type | Member | Description
--- | --- | ---
public readonly property | name `name as String` | Name of the executable entity.
public readonly property | parameterCount `parameterCount as Int` | Number of parameters expected.
public readonly property | returnType `returnType as String` | Return type.

Methods

Modifier and Type | Member | Description
--- | --- | ---
public | invoke `invoke(args as Object[]) as ReturnType throws Exception` | Invokes the entity with dynamic arguments.

Operators

Modifier and Type | Member | Description
--- | --- | ---
public | operator call(args as Object[]) as ReturnType throws Exception | Direct call operator.