klyn.reflection.Invocable.invoke
method
public invoke(args as Object[]) as ReturnType throws Exception
Description

Invokes the entity with dynamic arguments.

Parameters
ParameterDescription
argsArguments as Object array (use empty array for no args).
Returns

Result of type ReturnType.

Throws
  • TypeError if arguments don't match the runtime signature.
  • Exception if invocation fails.
Example
import klyn.reflection

f = eval("def fct(a as Int, b as Int): return a + b")
invokeArgs as Object[] = f:[10, 20]
result = f.invoke(invokeArgs) as Int