public class ReflectionHelper
extends java.lang.Object
Constructor and Description |
---|
ReflectionHelper() |
Modifier and Type | Method and Description |
---|---|
static boolean |
convertAllArguments(TypeConverter converter,
java.lang.Object[] arguments,
java.lang.reflect.Method method)
Convert a supplied set of arguments into the requested types.
|
static int |
getTypeDifferenceWeight(java.util.List<TypeDescriptor> paramTypes,
java.util.List<TypeDescriptor> argTypes)
Based on
MethodInvoker.getTypeDifferenceWeight(Class[], Object[]) but operates on TypeDescriptors. |
static java.lang.Object[] |
setupArgumentsForVarargsInvocation(java.lang.Class<?>[] requiredParameterTypes,
java.lang.Object... args)
Package up the arguments so that they correctly match what is expected in parameterTypes.
|
public static int getTypeDifferenceWeight(java.util.List<TypeDescriptor> paramTypes, java.util.List<TypeDescriptor> argTypes)
MethodInvoker.getTypeDifferenceWeight(Class[], Object[])
but operates on TypeDescriptors.public static boolean convertAllArguments(TypeConverter converter, java.lang.Object[] arguments, java.lang.reflect.Method method) throws SpelEvaluationException
converter
- the converter to use for type conversionsarguments
- the arguments to convert to the requested parameter typesmethod
- the target MethodSpelEvaluationException
- if there is a problem with conversionpublic static java.lang.Object[] setupArgumentsForVarargsInvocation(java.lang.Class<?>[] requiredParameterTypes, java.lang.Object... args)
(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.requiredParameterTypes
- the types of the parameters for the invocationargs
- the arguments to be setup ready for the invocation