Map<Method, List<Object>> nmatches = new HashMap<Method, List<Object>>();
for (Method mth : methods) {
boolean found = true;
List<Object> match = new ArrayList<Object>();
for (int i = 0; i < args.size(); i++) {
ReifiedType argType = new GenericType(mth.getGenericParameterTypes()[i]);
if (types.get(i) != null && !argType.getRawClass().equals(types.get(i).getRawClass())) {
found = false;
break;
}
//If the arg is an Unwrappered bean then we need to do the assignment check against the
//unwrappered bean itself.
Object arg = args.get(i);
Object argToTest = arg;
if(arg instanceof UnwrapperedBeanHolder)
argToTest = ((UnwrapperedBeanHolder)arg).unwrapperedBean;
if (!AggregateConverter.isAssignable(argToTest, argType)) {
found = false;
break;
}
try {
match.add(convert(arg, mth.getGenericParameterTypes()[i]));
} catch (Throwable t) {
found = false;
break;
}
}
if (found) {
nmatches.put(mth, match);
}
}
if (nmatches.size() > 0) {
matches = nmatches;
}
}
// Find a direct match with conversion
if (matches.size() != 1) {
Map<Method, List<Object>> nmatches = new HashMap<Method, List<Object>>();
for (Method mth : methods) {
boolean found = true;
List<Object> match = new ArrayList<Object>();
for (int i = 0; i < args.size(); i++) {
ReifiedType argType = new GenericType(mth.getGenericParameterTypes()[i]);
if (types.get(i) != null && !argType.getRawClass().equals(types.get(i).getRawClass())) {
found = false;
break;
}
try {
Object val = convert(args.get(i), argType);