public class ReflectionHelper extends Object
Modifier and Type | Class and Description |
---|---|
static class |
ReflectionHelper.ArgsMatchKind
Deprecated.
in its public form as of Spring 3.2.7, since there is no need to refer to this directly...
|
static class |
ReflectionHelper.ArgumentsMatchInfo
An instance of ArgumentsMatchInfo describes what kind of match was achieved
between two sets of arguments - the set that a method/constructor is expecting
and the set that are being supplied at the point of invocation.
|
Constructor and Description |
---|
ReflectionHelper() |
Modifier and Type | Method and Description |
---|---|
static void |
convertAllArguments(TypeConverter converter,
Object[] arguments,
Method method)
Convert a supplied set of arguments into the requested types.
|
static int |
getTypeDifferenceWeight(List<TypeDescriptor> paramTypes,
List<TypeDescriptor> argTypes)
Based on
MethodInvoker.getTypeDifferenceWeight(Class[], Object[]) but operates on TypeDescriptors. |
static Object[] |
setupArgumentsForVarargsInvocation(Class<?>[] requiredParameterTypes,
Object... args)
Package up the arguments so that they correctly match what is expected in parameterTypes.
|
public static int getTypeDifferenceWeight(List<TypeDescriptor> paramTypes, List<TypeDescriptor> argTypes)
MethodInvoker.getTypeDifferenceWeight(Class[], Object[])
but operates on TypeDescriptors.public static void convertAllArguments(TypeConverter converter, Object[] arguments, Method method) throws SpelEvaluationException
{Integer, String[]}
and the input arguments
are {Integer, boolean, float}
then both the boolean and float must be
converted to Strings). This method does not repackage the arguments into a
form suitable for the varargs invocation.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 Object[] setupArgumentsForVarargsInvocation(Class<?>[] requiredParameterTypes, 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