public interface Invocable<ReturnType>:
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, [])| Modifier and Type | Member | Description |
|---|---|---|
| public readonly property | namename as String |
Name of the executable entity. |
| public readonly property | parameterCountparameterCount as Int |
Number of parameters expected. |
| public readonly property | returnTypereturnType as String |
Return type. |
| Modifier and Type | Member | Description |
|---|---|---|
| public | invoke | Invokes the entity with dynamic arguments. |
| Modifier and Type | Member | Description |
|---|---|---|
| public | operator call(args as Object[]) as ReturnType throws Exception | Direct call operator. |