spring-framework / org.springframework.expression.spel.support / ReflectionHelper / setupArgumentsForVarargsInvocation

setupArgumentsForVarargsInvocation

open static fun setupArgumentsForVarargsInvocation(requiredParameterTypes: Array<Class<*>>, vararg args: Any): Array<Any>

Package up the arguments so that they correctly match what is expected in parameterTypes. For example, if parameterTypes is (int, String[]) because the second parameter was declared String..., then if arguments is [1,"a","b"] then it must be repackaged as [1,new String[]{"a","b"}] in order to match the expected types.

Parameters

requiredParameterTypes - the types of the parameters for the invocation

args - the arguments to be setup ready for the invocation

Return
a repackaged array of arguments where any varargs setup has been done