gh-pages / com.nextfaze.devfun.invoke / java.lang.reflect.Method / parameterInstances

parameterInstances

fun Method.parameterInstances(instanceProvider: InstanceProvider = devFun.instanceProviders, suppliedArgs: FunctionArgs = null): FunctionArgs (source)

Get the parameter instances for this method for invocation.

Be aware; this is intended for working with the method directly, a null value means no arguments.

The FunctionItem.invoke and FunctionDefinition.invoke handle 0 or more arguments automatically - i.e. they return an empty list to signify no arguments. However when invoking using Method directly, passing an empty list/array will be seen as an argument instead.

Thus a return of null from here means no arguments, which requires calling method.invoke(receiver) rather than method.invoke(receiver, args).

If you just want to invoke the method then use the doInvoke extension function.

Parameters

instanceProvider - The instance provider to use for parameters instances. (default=devFun.instanceProviders)

suppliedArgs - User-provided arguments (source-defined order). Elements that are null or out of bounds will fallback to instanceProvider.

See Also

FunctionDefinition.parameterInstances

FunctionItem.parameterInstances